Summary: | [code assist] NPE in findAllTypes | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Olivier Thomann <Olivier_Thomann> | ||||
Component: | Core | Assignee: | David Audel <david_audel> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | david_audel, jerome_lanneluc, philippe_mulet, srikanth_sankaran | ||||
Version: | 3.5 | Flags: | philippe_mulet:
pmc_approved+
|
||||
Target Milestone: | 3.5 M3 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Olivier Thomann
2008-10-28 15:27:42 EDT
I found steps to reproduce a similar bug 1) create an empty X.java 2) copy on the following content in X.java ZZZZZ 3) select ZZZZZ 4) do F3 This exception occurs java.lang.NullPointerException at org.eclipse.jdt.internal.codeassist.SelectionEngine.findAllTypes(SelectionEngine.java:733) at org.eclipse.jdt.internal.codeassist.SelectionEngine.select(SelectionEngine.java:927) at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:162) at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:375) at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:369) at org.eclipse.jdt.internal.ui.actions.SelectionConverter.codeResolve(SelectionConverter.java:252) at org.eclipse.jdt.internal.ui.actions.SelectionConverter$1$CodeResolveRunnable.run(SelectionConverter.java:236) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) We should fix for M3 since this is a regression comparing to M2. Created attachment 116431 [details]
Proposed fix
This patch add a null check to avoid the NPE.
Philippe, ok to put in 3.5M3 since this is an exception, this a regression comparing to M2 and the fix is trivial ? +1 for 3.5M3. Discussed in arch call. Released for 3.5M3. Test added ResolveTests#testEmptyCU1() When i fixed this bug i noticed some issues in SelectionEngine#checkSelection() (see bug 252481) The bug reference in my previous comment is incorrect it should be bug 252598 Verified for 3.5M4 using I20081208-1800 build |