Bug 60581 - "Java AST creation" error.
Summary: "Java AST creation" error.
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-30 11:44 EDT by Whitney Sorenson CLA
Modified: 2004-05-18 11:38 EDT (History)
0 users

See Also:


Attachments
The class that caused the error (3.42 KB, application/zip)
2004-04-30 12:26 EDT, Whitney Sorenson CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Whitney Sorenson CLA 2004-04-30 11:44:27 EDT
Build 200404281424.

I was working on some code inside an inner class, and I cut/pasted into the main
class, and this error message came up in an error box. Once I closed the error
box, it kept reappearing, and I had to shut down Eclipse.

!MESSAGE An internal error occurred during: "Java AST creation".
!STACK 0
java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2587)
	at
org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2676)
	at
org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:2721)
	at
org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:367)
	at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:327)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:271)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:149)
	at org.eclipse.jdt.core.dom.ASTParser.convert(ASTParser.java:707)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:677)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:573)
	at
org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:437)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:389)
	at
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:123)
	at
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$1.run(SelectionListenerWithASTManager.java:101)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:66)
Comment 1 Olivier Thomann CLA 2004-04-30 12:04:22 EDT
Could you please attach to this PR the source of the class you paste?
I need to investigate asap.
Comment 2 Whitney Sorenson CLA 2004-04-30 12:26:01 EDT
Created attachment 10175 [details]
The class that caused the error

Here is a zip of the java file exactly as it was when the error occured. The
second time I was able to reproduce I simply had to paste the second set of    
	   }}}; below the private PropertyChangeListener stackListener = new
PropertyChangeListener() { line.
Comment 3 Olivier Thomann CLA 2004-04-30 12:39:06 EDT
Reproduced. It seems to be a problem with positions and syntax errors in code.
Comment 4 Olivier Thomann CLA 2004-04-30 14:40:45 EDT
We are in a case a field declaration has no declaration end and no declaration
source end.
There are two ways to fix it:
1) close the field declaration inside the updateOnClosingBrace(...)
2) close the field declaration inside the updatedFieldDeclaration()
Comment 5 Olivier Thomann CLA 2004-04-30 15:56:48 EDT
I patch this problem.
David, could you please double-check my change in:
RecoveredField#updateOnClosingBrace(int, int)?

Thanks.
Comment 6 Olivier Thomann CLA 2004-04-30 15:58:21 EDT
David, I added regression tests in ASTConverterTest2.
Comment 7 David Audel CLA 2004-05-04 05:37:04 EDT
Fix seems good for me

Fixed.
Comment 8 Olivier Thomann CLA 2004-05-18 11:38:32 EDT
Verified in 200405180816