Community
Participate
Working Groups
I think this is a consequence of the fix for bug 183211. I am getting the following NPE when typing a static import statement into the editor: !ENTRY org.eclipse.core.jobs 4 2 2008-03-19 13:40:04.008 !MESSAGE An internal error occurred during: "Requesting Java AST from selection". !STACK 0 java.lang.NullPointerException at java.lang.String.<init>(String.java:176) at org.eclipse.jdt.core.dom.TypeBinding.getName(TypeBinding.java:621) at org.eclipse.jdt.internal.ui.search.OccurrencesFinder.initialize(OccurrencesFinder.java:88) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.updateOccurrenceAnnotations(JavaEditor.java:3258) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$7.selectionChanged(JavaEditor.java:3284) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:176) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:153) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) To reproduce, create a project with the following two files: // p1/X.java: package p1; interface I { class A {} } class C { public static class A {} } public class X extends C implements I {} // p2/Y.java: package p2; class Y {} Now, put the cursor in Y.java on the line before the class declaration, and attempt to type the following: import static p1.X.A; The above NPE happens. Closing the NPE error message immediately brings another error message to the front, and so forth, so there is no way to exit the editor except by killing the task in Task Manager. This is a regression: in I20080305, all that would happen is that the static import statement would get a compile error, "type p1.X.A is not visible".
This is a regression indeed, but I don't think it is easy to find. So we can fix it during M7 (if unable to tackle it during M6).
I've removed the patch for bug 183211 and it doesn't fix this problem. And I was able to reproduce this problem with the build I20080318-0800
I was able to reproduce this in M4 so its been around for a while now. Was fine in 3.3.2
I think I see what's happening. When I try this in I20080304, I'm still getting the NPE, but it is nonfatal, it just gets logged to the error log. When I tried it in a target workbench launched from my dev workbench synced to HEAD, I got the fatal (i.e. have to kill process with task mgr) problem I described. I haven't had a chance to the latest build so I don't know whether it will be fatal in that context. I will give that a try. I agree that if the problem is just being logged, it is not important to fix by M6.
In 20080319-2000, when I test this in a normal workspace (as opposed to a target workspace launched from PDE), the NPE is logged but does not cause any other problems. Reducing severity to "normal".
Fix is included in latest version of patch for bug 183211. https://bugs.eclipse.org/bugs/attachment.cgi?id=93065
Fixed
Problem is fixed. Thanks!