Bug 77968 - [compiler] ArrayIndexOutOfBoundsException from parser when using Java editor
Summary: [compiler] ArrayIndexOutOfBoundsException from parser when using Java editor
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-05 12:14 EST by Rafael Chaves CLA
Modified: 2004-12-14 10:26 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Chaves CLA 2004-11-05 12:14:19 EST
build: i200411050810

Didn't notice anything going wrong, just saw the log entry by chance. Don't know
how to reproduce, sorry.

!ENTRY org.eclipse.jdt.ui 4 10001 2004-11-05 11:55:23.703
!MESSAGE Internal Error
!STACK 0
java.lang.ArrayIndexOutOfBoundsException
	at
org.eclipse.jdt.internal.compiler.parser.Scanner.getCurrentTokenSource(Scanner.java:380)
	at
org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.readTokenFromScanner(LexStream.java:84)
	at
org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.token(LexStream.java:137)
	at
org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.kind(LexStream.java:177)
	at
org.eclipse.jdt.internal.compiler.parser.diagnose.DiagnoseParser.diagnoseParse(DiagnoseParser.java:293)
	at
org.eclipse.jdt.internal.compiler.parser.Parser.reportSyntaxErrors(Parser.java:9014)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8397)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:8640)
	at
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.parseStatements(MethodDeclaration.java:108)
	at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:630)
	at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:442)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:722)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574)
	at
org.eclipse.jdt.internal.ui.text.correction.LocalCorrectionsSubProcessor.addUncaughtExceptionProposals(LocalCorrectionsSubProcessor.java:99)
	at
org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.process(QuickFixProcessor.java:258)
	at
org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.getCorrections(QuickFixProcessor.java:190)
	at
org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectCorrections(JavaCorrectionProcessor.java:240)
	at
org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.processAnnotations(JavaCorrectionProcessor.java:208)
	at
org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.computeCompletionProposals(JavaCorrectionProcessor.java:177)
	at
org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1472)
	at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:251)
	at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$7(CompletionProposalPopup.java:247)
	at
org.eclipse.jface.text.contentassist.CompletionProposalPopup$1.run(CompletionProposalPopup.java:206)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:201)
	at
org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1320)
	at
org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionAssistant.showPossibleCompletions(JavaCorrectionAssistant.java:159)
	at
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:186)
	at
org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:122)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:120)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:988)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:188)
	at org.eclipse.ui.internal.commands.Command.execute(Command.java:130)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:445)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:724)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:767)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:536)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:479)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:221)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:748)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:799)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:824)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:809)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:837)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:833)
	at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1322)
	at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:3331)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3016)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3361)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1502)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2446)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1529)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1500)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:276)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:704)
	at org.eclipse.core.launcher.Main.main(Main.java:688)
Comment 1 Olivier Thomann CLA 2004-11-05 13:09:38 EST
I have a test case for this one. Thanks to Rafael.
Comment 2 Olivier Thomann CLA 2004-11-08 15:06:39 EST
David, it blows up in the diagnose parser.
Comment 3 Olivier Thomann CLA 2004-11-08 15:07:11 EST
I can give you the test case. I will send it to you by mail.
Comment 4 David Audel CLA 2004-11-10 09:54:26 EST
Fixed and test added
  ASTConverterTestAST3_2#test0573()

The bug is not inside diagnose parser but inside CompilationUnitResolver#resolve().
When bindings of a partial ast needed to be resolved there was no call to
scanner.setSource() before parse a method body. So the source inside the scanner
was not the correct source.
Comment 5 Frederic Fusier CLA 2004-12-14 10:26:31 EST
Verified for 3.1 M4 using build I200412140800.