Project: JDT
Bug 149797 [quick assist] NPE in ConvertForLoopOperation
Reported: 2006-07-06 06:00:04 | Status: verified fixed

I20060704-0800 Given: package test; public class E { private int ba r() {return 0;} public void foo(int[] ints) { for^(int i = 0, max = ints.length, b= bar(); i < max; i++) { System.out.println(ints[i] + b); } } } 1. _Select_ space at ^ 2. Ctrl-1 Is: java.lang.NullPointerException at org.eclipse.jdt.internal.corext.fix.ConvertForLoopOperation$3.visit(ConvertForLoopOperation.java:726) at org.eclipse.jdt.core.dom.MethodInvocation.accept0(MethodInvocation.java:236) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2466) at org.eclipse.jdt.internal.corext.fix.ConvertForLoopOperation.doInferCollectionFromExpression(ConvertForLoopOperation.java:715) at org.eclipse.jdt.internal.corext.fix.ConvertForLoopOperation.doInferCollectionFromInitializers(ConvertForLoopOperation.java:697) at org.eclipse.jdt.internal.corext.fix.ConvertForLoopOperation.doInferCollection(ConvertForLoopOperation.java:639) at org.eclipse.jdt.internal.corext.fix.ConvertForLoopOperation.arrayCanBeInferred(ConvertForLoopOperation.java:416) at org.eclipse.jdt.internal.corext.fix.ConvertForLoopOperation.satisfiesPreconditions(ConvertForLoopOperation.java:188) at org.eclipse.jdt.internal.corext.fix.ControlStatementsFix.createConvertForLoopToEnhancedFix(ControlStatementsFix.java:294) at org.eclipse.jdt.internal.ui.text.correction.QuickAssistProcessor.getConvertForLoopProposal(QuickAssistProcessor.java:1150) at org.eclipse.jdt.internal.ui.text.correction.QuickAssistProcessor.getAssists(QuickAssistProcessor.java:166) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeAssistCollector.safeRun(JavaCorrectionProcessor.java:369) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:307) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:297) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectAssists(JavaCorrectionProcessor.java:473) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectProposals(JavaCorrectionProcessor.java:255) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.computeQuickAssistProposals(JavaCorrectionProcessor.java:211) at org.eclipse.jface.text.quickassist.QuickAssistAssistant$ContentAssistProcessor.computeCompletionProposals(QuickAssistAssistant.java:64) at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1733) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:476) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$17(CompletionProposalPopup.java:473) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:408) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:402) at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1562) at org.eclipse.jface.text.quickassist.QuickAssistAssistant.showPossibleQuickAssists(QuickAssistAssistant.java:117) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionAssistant.showPossibleQuickAssists(JavaCorrectionAssistant.java:176) ...

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertForLoopQuickFixTest.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/ConvertForLoopOperation.java