Bug 207411 - [1.5][compiler] NPE in ASTNode.resolveAnnotations
Summary: [1.5][compiler] NPE in ASTNode.resolveAnnotations
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-10-25 03:48 EDT by Markus Keller CLA
Modified: 2007-12-11 12:04 EST (History)
3 users (show)

See Also:


Attachments
proposed patch - null check since resolved annotation could be null (928 bytes, patch)
2007-11-13 17:30 EST, Karen Butzke CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-10-25 03:48:46 EDT
HEAD (ASTNode.java 1.88)

Have CU:

@Deprecated @Suppress
public class Try {
}


!ENTRY org.eclipse.jdt.ui 4 0 2007-10-25 09:47:56.734
!MESSAGE Error in JDT Core during AST creation
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.ast.ASTNode.resolveAnnotations(ASTNode.java:606)
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.getAnnotationTagBits(SourceTypeBinding.java:685)
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:582)
	at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:431)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:849)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:518)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:869)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:653)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:540)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:533)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:474)
	at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:122)
	at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.getClipboardData(ClipboardOperationAction.java:406)
	at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.doCutCopyWithImportsOperation(ClipboardOperationAction.java:332)
	at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.internalDoOperation(ClipboardOperationAction.java:288)
	at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction$1.run(ClipboardOperationAction.java:257)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.run(ClipboardOperationAction.java:255)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
	at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:475)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:470)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:165)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:470)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:821)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:879)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:568)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:510)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:126)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1154)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:946)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:971)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:956)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:984)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:980)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1294)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3789)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3682)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:334)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4423)
	at org.eclipse.swt.internal.win32.OS.$$YJP$$DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(OS.java)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2319)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3353)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2395)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2359)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2225)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:468)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:463)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:362)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:515)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:455)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1193)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1169)
Comment 1 Karen Butzke CLA 2007-11-13 13:01:18 EST
This bug appeared because of the changes made to ASTNode on 10/23/07.  It is fairly annoying since any time you are typing in an annotation that is not yet resolved you get this NPE.  It is a regression from 3.4M2.  Looks like the fix is a simple null check.  Any chance we can get a fix for M4?
Comment 2 Karen Butzke CLA 2007-11-13 17:30:52 EST
Created attachment 82813 [details]
proposed patch - null check since resolved annotation could be null
Comment 3 Philipe Mulet CLA 2007-11-14 06:42:01 EST
Good find. Will look into it for 3.4M4.
Comment 4 Philipe Mulet CLA 2007-11-14 07:01:44 EST
Added AnnotationTest#test240
Released for 3.4M4.
Fixed

Tagged as contributed.
Comment 5 Philipe Mulet CLA 2007-11-14 07:10:00 EST
Name: Karen Moore
Company: Oracle
Email: karen.moore@oracle.com
Business Address:
Business Phone:
Contribution:
        Provided patch https://bugs.eclipse.org/bugs/show_bug.cgi?id=207411
Title/Rights: EPL 1.0
Comment 6 Kent Johnson CLA 2007-12-11 12:04:03 EST
Verified for 3.4M4 using build I20071210-1800.