Bug 48195 - Changed Java files no longer editable, raises IllegalArgumentException
Summary: Changed Java files no longer editable, raises IllegalArgumentException
Status: RESOLVED DUPLICATE of bug 47396
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 M6   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-05 18:06 EST by Li-Te Cheng CLA
Modified: 2003-12-17 08:13 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 Li-Te Cheng CLA 2003-12-05 18:06:20 EST
I'm running Eclipse 3.0 milestone 5 with Sun JDK 1.4.2

I changed a Java class into an interface by hand and renamed it by hand, which 
triggers the error log message: "An internal error occurred during Java AST 
Creation" and the progress message: "ERROR: Java AST Creation: An internal 
error occurred during Java AST Creation".

Once this error is triggered, any attempt to click on the Java editor with the 
changed file triggers another error and defocuses the editor, making the file 
effectively uneditable.  A workaround solution is to copy text (copy/select 
still works), delete the file, and then recreate the file from scratch.

I tried to pinpoint the steps to reproduce this problem, and it appears to be 
the following steps:

1.  create an empty Java class in some package

2.  in the Java editor, change "class" to "interface" by hand and
    rename the name of the class by hand (e.g. add an "I" in front of the name)

3.  JDT immediately shows a red mark and a code-assist suggesting to 
    recompile the compilation unit w/ the new name, or to revert to the old 
    name.  Choose to recompile/refactor w/ the new name.

4.  the Package Explorer and editor updates w/ the new name, and the 
    "Java AST creation" error appears.  The editor loses focus, any attempt
    to click/type in the editor raises the error again and defocuses the 
    editor.  It is impossible to type anything in the editor for that file.

5.  close Eclipse and open Eclipse again.  Open the changed file in the
    Java editor, and the same error still gets triggered.

This error may be related to bug #47617 ("Java AST Creation")

The stack trace from the error is as follows:

java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:1486)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:701)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations
(ASTConverter.java:244)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:183)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:81)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:354)
	at org.eclipse.jdt.core.dom.AST.parseCompilationUnit(AST.java:247)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartLis
tenerGroup.computeAST(SelectionListenerWithASTManager.java:106)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartLis
tenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:116)
	at 
org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$1.run
(SelectionListenerWithASTManager.java:92)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:62)
Comment 1 Olivier Thomann CLA 2003-12-07 11:58:29 EST
Close as duplicate of bug 47396.

*** This bug has been marked as a duplicate of 47396 ***
Comment 2 Frederic Fusier CLA 2003-12-16 13:36:56 EST
Verified that this does not happen with build I200312160010.

But, even strictly following described scenario, I didn't succeed to reproduce 
either with 3.0 M5 or 2.1.2 build!?

One question about scenario is: are you sure that code-assist provide 
recompile/refactor actions?
I've used Quick-fix "Rename compilation unit to 'IX.java'" and refactoring in 
package explorer and both actions works without any AST error message.

Comment 3 Li-Te Cheng CLA 2003-12-17 08:13:29 EST
Apologies - you're correct, I was using Quick-fix ("Rename compilation unit 
to 'IX.java'"), not code-assist.  

Also, for some reason I'm no longer able to reproduce the error either.  
Beyond installing Java Spider on my copy of 3.0 M5, there hasn't been any 
changes to my Eclipse setup.

It's probably best then to close this bug and not worry about it, since it 
appeared to be pretty spurious, and M6 will probably not encounter this 
problem anyhow.  Thanks for looking into this.