Bug 273691 - NullPointerException using JDT weaving with a reference to void.class
Summary: NullPointerException using JDT weaving with a reference to void.class
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: 1.6.4   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 major (vote)
Target Milestone: 2.0.0   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 278531 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-04-25 16:04 EDT by Robert Elliot CLA
Modified: 2009-06-03 12:39 EDT (History)
2 users (show)

See Also:


Attachments
Aspect demonstrating the problem (154 bytes, text/plain)
2009-04-25 16:05 EDT, Robert Elliot CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Elliot CLA 2009-04-25 16:04:30 EDT
Build ID: M20090211-1700

Steps To Reproduce:
1. Turn on JDT weaving
2. Create an AspectJ project and add the attached aspect to it
3. Try and do some code completion - may require an edit, a save and then another attempt at code completion before it blows up.

Some debugging suggests that the problem lies in org.aspectj.org.eclipse.jdt.internal.compiler.parser.Scanner - it is incorrectly viewing the 'class' token in the statement o.equals(void.class) as the start of a class declaration.


More information:
eclipse.buildId=M20090211-1700
java.version=1.5.0_16
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=carbon, NL=en_GB
Framework arguments:  -keyring /Users/Robert/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws carbon -arch x86 -keyring /Users/Robert/.eclipse_keyring -consoleLog -showlocation


Warning
Sat Apr 25 19:34:19 BST 2009
The 'org.eclipse.jdt.ui.JavaTypeCompletionProposalComputer' proposal computer from the 'org.eclipse.jdt.ui' plug-in did not complete normally. The extension has thrown a runtime exception.

java.lang.NullPointerException
at java.lang.String.<init>(String.java:173)
at org.eclipse.ajdt.core.codeconversion.AspectsConvertingParser.getInterTypeDecls(AspectsConvertingParser.java:625)
at org.eclipse.ajdt.core.codeconversion.AspectsConvertingParser.convert(AspectsConvertingParser.java:394)
at org.eclipse.ajdt.core.codeconversion.JavaCompatibleBuffer.ensureUpToDate(JavaCompatibleBuffer.java:149)
at org.eclipse.ajdt.core.codeconversion.JavaCompatibleBuffer.getInsertionTable(JavaCompatibleBuffer.java:185)
at org.eclipse.ajdt.internal.core.contentassist.ProposalRequestorWrapper.<init>(ProposalRequestorWrapper.java:44)
at org.eclipse.ajdt.core.javaelements.AJCompilationUnit.codeComplete(AJCompilationUnit.java:573)
at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:344)
at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:337)
at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.internalComputeCompletionProposals(JavaCompletionProposalComputer.java:190)
at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.computeCompletionProposals(JavaCompletionProposalComputer.java:156)
at org.eclipse.jdt.internal.ui.text.java.JavaTypeCompletionProposalComputer.computeCompletionProposals(JavaTypeCompletionProposalComputer.java:58)
at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:316)
at org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:264)
at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:285)
at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:245)
at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1836)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:555)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:552)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:487)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:481)
at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1664)
at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:179)
at org.eclipse.ajdt.internal.ui.editor.AspectJEditor$AJTextOperationTarget.doOperation(AspectJEditor.java:169)
at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80)
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:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:472)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:824)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:882)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:571)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:512)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:127)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1130)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1560)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1585)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1570)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1622)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1617)
at org.eclipse.swt.widgets.Control.kEventUnicodeKeyPressed(Control.java:2292)
at org.eclipse.swt.widgets.Composite.kEventUnicodeKeyPressed(Composite.java:586)
at org.eclipse.swt.widgets.Control.kEventTextInputUnicodeForKeyEvent(Control.java:2254)
at org.eclipse.swt.widgets.Canvas.kEventTextInputUnicodeForKeyEvent(Canvas.java:232)
at org.eclipse.swt.widgets.Widget.textInputProc(Widget.java:1995)
at org.eclipse.swt.widgets.Display.textInputProc(Display.java:3970)
at org.eclipse.swt.internal.carbon.OS.SendEventToEventTarget(Native Method)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3051)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
Comment 1 Robert Elliot CLA 2009-04-25 16:05:24 EDT
Created attachment 133227 [details]
Aspect demonstrating the problem
Comment 2 Robert Elliot CLA 2009-04-25 16:07:28 EDT
Incidentally, is there a reason why it's newing up a String at line 625 of AspectsConvertingParser?  I was under the impression String, as an immutable class, never needed to be defensively copied.
Comment 3 Robert Elliot CLA 2009-04-25 16:38:59 EDT
Cancel my last comment... being thick, currentTypeName is of course a char[] not a String.  Sorry.
Comment 4 Andrew Eisenberg CLA 2009-04-25 17:31:18 EDT
Thanks for the test case.  

It is indeed a problem with AspectsConvertingParser misinterpreting the void.class to be a class declaration.

I have a fix for this, but haven't committed it yet.  Probably won't get to it until Monday.
Comment 5 Andrew Eisenberg CLA 2009-04-27 13:43:51 EDT
Fix committed with regression tests.  Will be available in next dev build.
Comment 6 Robert Elliot CLA 2009-04-27 14:13:39 EDT
Great, thanks.
Comment 7 Andrew Eisenberg CLA 2009-06-03 12:39:23 EDT
*** Bug 278531 has been marked as a duplicate of this bug. ***