Bug 212434 - [dom] IllegalArgumentException during AST Creation
Summary: [dom] IllegalArgumentException during AST Creation
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-10 12:28 EST by Dan Heidinga CLA
Modified: 2008-03-25 11:00 EDT (History)
2 users (show)

See Also:


Attachments
Test case for bug. (4.25 KB, application/octet-stream)
2007-12-10 12:29 EST, Dan Heidinga CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Heidinga CLA 2007-12-10 12:28:09 EST
Build ID: M20071023-1652

Steps To Reproduce:
-------------------
1.  Unzip the project in the zip file
2.  Toggle the comment on line 38:
	final //Object....
3.  Watch the Exceptions appear in the error log

More information:
-----------------
I tried to trim the test case down further, but if I remove the code in the last 'if (false)' block (lines 58-69) the problem goes away.

The problem is completely reproducible.

Stack Trace:
------------
java.lang.IllegalArgumentException
at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2609)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:483)
at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:318)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2283)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1537)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2476)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:511)
at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:179)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2661)
at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1248)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:255)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:892)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:651)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:609)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:602)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:514)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:155)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:140)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 1 Dan Heidinga CLA 2007-12-10 12:29:27 EST
Created attachment 84881 [details]
Test case for bug.

Attachment failed when creating bug
Comment 2 Olivier Thomann CLA 2008-03-06 10:05:27 EST
Cannot reproduce using I20080304-1113.
Could you please check again?
Comment 3 Dan Heidinga CLA 2008-03-06 10:16:15 EST
Agreed.  Problem doesn't seem reproducible in Eclipse 3.4.0 - I20080207-1530.

Are the changes necessary to fix this going to be back ported to 3.3.1? 
Comment 4 Olivier Thomann CLA 2008-03-06 10:29:02 EST
Reproduced with 3.3.2.
A fix should be investigated for post 3.3.2 builds.
Since this is related to code recovery, I reassign to David.
Comment 5 David Audel CLA 2008-03-19 06:57:12 EDT
The problem can be reproduced in 3.3.2 and not in 3.4.

The smallest test case to reproduce the bug is:
public class Junk {
	public void foo() {
		new Object() { 
			public void bar() { 
				if (true) {
					final
				}
			}

		};  

		if (false) {
			Object var = new Object() {
				void toto() {
				}
			};
		}
	}
}

Comment 6 David Audel CLA 2008-03-20 10:28:57 EDT
As the problem is already fixed in 3.4, i close this bug as WORKSFORME.

I added a regression test
  ASTConverterBugsTest#testBug212434a()
Comment 7 Jerome Lanneluc CLA 2008-03-25 11:00:50 EDT
Verified for 3.4M6 using I20080325-0100