Bug 64377 - CRASH: An internal error occurred during: "Java AST creation"
Summary: CRASH: An internal error occurred during: "Java AST creation"
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows NT
: P3 critical (vote)
Target Milestone: 3.0 RC1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-27 12:10 EDT by Anton Tagunov CLA
Modified: 2004-05-28 15:47 EDT (History)
0 users

See Also:


Attachments
Sample .log containing stack traces for this error (22.52 KB, text/plain)
2004-05-27 12:12 EDT, Anton Tagunov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Tagunov CLA 2004-05-27 12:10:36 EDT
Steps to reproduce:

1. Create a new Java project
2. Create class A in top-level package
3. Delete all generated contents of A.java
4. Paste the following code

class A
{
	A( B b, C c )
	{
	
	interface B
	{
	}
	
	interface C
	{
	}
}

5. Press Ctrl+S

What I see:

Dialog box pops up:
Java AST creation (Error: An internal error occured during: "Java AST creation".
)

Clicking on error in this dialog box makes lower part of dialog box show stack 
trace:
An internal error occurred during: "Java AST creation".
java.lang.ArrayIndexOutOfBoundsException: -1
org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:5490)
org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:5450)
org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.
parseStatements(ConstructorDeclaration.java:368)
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.
parseMethod(TypeDeclaration.java:791)
org.eclipse.jdt.internal.compiler.parser.Parser.getMethodBodies(Parser.java:
4665)
org.eclipse.jdt.core.dom.CompilationUnitResolver.
resolve(CompilationUnitResolver.java:404)
org.eclipse.jdt.core.dom.CompilationUnitResolver.
resolve(CompilationUnitResolver.java:313)
org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:653)
org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:573)
org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:
437)
org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:389)
org.eclipse.jdt.internal.ui.viewsupport.
SelectionListenerWithASTManager$PartListenerGroup.
calculateASTandInform(SelectionListenerWithASTManager.java:123)
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$1.
run(SelectionListenerWithASTManager.java:101)
org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)

Pressing "Close" on this dialog box causes the dialog to close but the same 
dialog box re-appears immediately.

When I exit Eclipse it asks me if I want to save A.java. If I answer "yes" it 
pops another dialog box: Save All Failed: -1

After that Eclise window closes, but javaw.exe remains running in the 
background. If I relaunch Eclipse for the same workspace I get dialog box:
Workspace in use, choose a different one. If I kill javaw.exe from Task Manager 
I can launch Eclipse for that workspace again.

What I expect to see

A) When Eclipse exists albeit after all these errors I expect no javaw.exe to 
remain running

B) After I close the first error dialog box I expect it not to reappear again

C) I expect Eclipse to parse this incorrect java code and just treat it as 
incorrect code, not to blow up

Cheers!
Comment 1 Anton Tagunov CLA 2004-05-27 12:12:32 EDT
Created attachment 11208 [details]
Sample .log containing stack traces for this error
Comment 2 Anton Tagunov CLA 2004-05-27 12:40:30 EDT
I figured out why javaw.exe was not exiting, I've got lots of small windows 
output maybe by eclipse.exe binary java launcher. They say:

JVM terminated. Exit code=1

and all the arguments given javaw.exe at launch. One complaint less :-)

BTW, exact build of Eclipse I'm running (this should be the M9)
Build id: 200405211200
Comment 3 Olivier Thomann CLA 2004-05-27 13:04:42 EDT
I am investigating. This is also a bug in the compiler.
I get this compiling the code using the batch compiler:

----------
1. ERROR in C:\tests_sources\A.java (at line 0)
	class A
	^
Internal compiler error
java.lang.ArrayIndexOutOfBoundsException: -1
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:5489)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:5449)
	at
org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.parseStatements(ConstructorDeclaration.java:368)
	at
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.parseMethod(TypeDeclaration.java:790)
	at
org.eclipse.jdt.internal.compiler.parser.Parser.getMethodBodies(Parser.java:4665)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:497)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
	at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:1543)
	at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:320)
	at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:213)
	at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:205)
	at org.eclipse.jdt.core.tools.compiler.Compile.main(Compile.java:19)

----------
2. ERROR in C:\tests_sources\A.java (at line 6)
	interface B
	          ^
The member interface B can only be defined inside a top-level class or interface
----------
3. ERROR in C:\tests_sources\A.java (at line 10)
	interface C
	          ^
The member interface C can only be defined inside a top-level class or interface
----------
4. ERROR in C:\tests_sources\A.java (at line 13)
	}
	^
Syntax error, insert "}" to complete ClassBody
----------
Comment 4 Olivier Thomann CLA 2004-05-27 15:16:17 EDT
I think we had two bugs.
1) The way we handle the invalid interface declarations was not right => leading
to the exception.
2) During the recovery, we should not include the two interfaces inside the
constructor declaration.
I am working on a fix for these two problems.
Comment 5 Olivier Thomann CLA 2004-05-27 15:51:47 EDT
Fixed and released in HEAD.
Regression test added.
Comment 6 Anton Tagunov CLA 2004-05-28 08:48:39 EDT
Still same bug in build 200405280010
Btw, jvm really hanging after this bug
until I kill it from Task Manager
Comment 7 Olivier Thomann CLA 2004-05-28 09:37:03 EDT
Of course you found the same bug in 200405280010. JDT/Core didn't submit any
code for that build.
This is fixed. So wait for the next build with a submission from JDT/Core and
you will see it fixed.
Reopened it only if it is not fixed then.
Comment 8 Olivier Thomann CLA 2004-05-28 15:47:42 EDT
Verified in 200405281200