Bug 54061 - AST error while typing beginning of a method
Summary: AST error while typing beginning of a method
Status: RESOLVED WORKSFORME
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.0 M8   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-08 13:17 EST by Martin Möbius CLA
Modified: 2004-03-22 12:27 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 Martin Möbius CLA 2004-03-08 13:17:30 EST
Build id: 200402250800

Sometimes I get a message box with an error about the AST not able to create
anew element (see stacktrace from .log at the end).
I got it reproducable with the test case below.
just try to insert a new method manually befor the last existng method
(   public S
    ^^^^^^^^^)
I don't know if the class SolarSystem matters, but it also produces the error
when commenting out all the members in this class, so an empty class should do it.



package model;

public class Universe {

    SolarSystem[][] fSystems;
    SolarSystem fEmptySystem = new SolarSystem();
    
    public Universe(int height, int width){
        fSystems = new SolarSystem[height][width];
        initUnivers();
    }

        
    private void initUnivers() {
        for (int i = 0; i < fSystems.length; i++) {
            for (int j = 0; j < fSystems[0].length; j++) {
                fSystems[i][j]=fEmptySystem;
            }
        }
    }
    
   /* public SolarSystem getSystem(int index){
        SolarSystem solarSystem = new SolarSystem();
        return null;
    }*/

    public S
    ^^^^^^^^^

    SolarSystem[][] getSystems(){
        return fSystems;
    }
}

ENTRY org.eclipse.core.runtime 4 2 Mrz 08, 2004 18:57:55.514
!MESSAGE An internal error occurred during: "Java AST creation".
!STACK 0
java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:1796)
	at
org.eclipse.jdt.core.dom.ASTConverter.updateInnerPositions(ASTConverter.java:2807)
	at org.eclipse.jdt.core.dom.ASTConverter.setTypeForField(ASTConverter.java:2791)
	at
org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:2725)
	at
org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:359)
	at
org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:319)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:263)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:142)
	at org.eclipse.jdt.core.dom.ASTParser.parseCompilationUnit(ASTParser.java:1091)
	at
org.eclipse.jdt.core.dom.ASTParser.temporaryCreateASTDispatch(ASTParser.java:569)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:542)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:900)
	at
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.computeAST(SelectionListenerWithASTManager.java:125)
	at
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:144)
	at
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$1.run(SelectionListenerWithASTManager.java:99)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:62)
Comment 1 Olivier Thomann CLA 2004-03-09 09:29:01 EST
I cannot reproduce using 0304. Could you please try again with that build and
tell me if you can get it?

Thanks.
Comment 2 Martin Möbius CLA 2004-03-09 15:01:05 EST
Not reproduceable fro me on 0304. Closing. Will reopen if it happens again