Community
Participate
Working Groups
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!
Created attachment 11208 [details] Sample .log containing stack traces for this error
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
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 ----------
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.
Fixed and released in HEAD. Regression test added.
Still same bug in build 200405280010 Btw, jvm really hanging after this bug until I kill it from Task Manager
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.
Verified in 200405281200