Community
Participate
Working Groups
I have the following source code which contains a compile error since the type of the field is unknown. I can build an AST for it but if I try to resolve the binding of the field 'field' I get a NPE. Here is the source code public class A { List field; } Log: Fri Feb 08 15:08:07 CET 2002 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Log: Fri Feb 08 15:08:07 CET 2002 4 org.eclipse.ui 0 java.lang.NullPointerException java.lang.NullPointerException Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V java/lang/NullPointerException.<init>(Ljava/lang/String;)V org/eclipse/jdt/core/dom/DefaultBindingResolver.getVariableBinding (Lorg/eclipse/jdt/internal/compiler/lookup/VariableBinding;) Lorg/eclipse/jdt/core/dom/IVariableBinding; org/eclipse/jdt/core/dom/DefaultBindingResolver.resolveVariable (Lorg/eclipse/jdt/core/dom/VariableDeclaration;) Lorg/eclipse/jdt/core/dom/IVariableBinding; org/eclipse/jdt/core/dom/VariableDeclaration.resolveBinding() Lorg/eclipse/jdt/core/dom/IVariableBinding; org/eclipse/jdt/internal/corext/refactoring/sef/SelfEncapsulateFieldRefactoring. checkActivation(Lorg/eclipse/core/runtime/IProgressMonitor;) Lorg/eclipse/jdt/internal/corext/refactoring/base/RefactoringStatus; org/eclipse/jdt/internal/ui/refactoring/actions/RefactoringStarter.activate (Lorg/eclipse/jdt/internal/corext/refactoring/base/Refactoring;Lorg/eclipse/jdt/ internal/ui/refactoring/RefactoringWizard;Ljava/lang/String;Z)V org/eclipse/jdt/internal/ui/refactoring/actions/SelfEncapsulateFieldAction.run() V org/eclipse/jface/action/Action.runWithEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/jface/action/ActionContributionItem.handleWidgetSelection (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.handleWidgetEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.access$0 (Lorg/eclipse/jface/action/ActionContributionItem;Lorg/eclipse/swt/widgets/Event ;)V org/eclipse/jface/action/ActionContributionItem$ActionListener.handleEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/swt/widgets/Widget.notifyListeners (ILorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Display.runDeferredEvents()Z org/eclipse/swt/widgets/Display.readAndDispatch()Z org/eclipse/ui/internal/Workbench.runEventLoop()V org/eclipse/ui/internal/Workbench.run(Ljava/lang/Object;)Ljava/lang/Object; org/eclipse/core/internal/boot/InternalBootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;) Ljava/lang/Object; org/eclipse/core/boot/BootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;) Ljava/lang/Object; SlimLauncher.main([Ljava/lang/String;)V
In this case we should return null. The error saying that the type List cannot be resolved should be reported on the compilatio unit. I am working on it.
Missing a null check. Fixed and released in HEAD.