Bug 136972 - [reconciler] Error in static init blok with inner classes
Summary: [reconciler] Error in static init blok with inner classes
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC2   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-17 06:34 EDT by Andrey Loskutov CLA
Modified: 2006-04-28 14:29 EDT (History)
2 users (show)

See Also:


Attachments
Regression test (1.78 KB, patch)
2006-04-17 23:26 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix (2.76 KB, patch)
2006-04-19 03:54 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2006-04-17 06:34:58 EDT
Build id: I20060413-1718
In a 1.5 Java project, during typing of special code in the Java editor, 4 errors are reported in the Error view. The 4 errors will be reported during typing of a new class name in static initializer block, immediately after entring of the first class name character. This happens only if below of the cursor an anonymous inner class already exists in the code. 

The code is of course not usual and it was written to test the generation of inner classes. 

-------------
package a;
public class Test {
	static {
		class A  // cursor is after A => 4 exceptions in the log
		Object o = new Object(){
			void test(){
			}
		};
	}
}
-------------

The "full" test code triggers no exceptions and could be compiled fine:

-------------
package a;
public class Test {
	static {
		class A {
		}
		Object o = new Object(){
			void test(){
			}
		};
	}
}
----------------

Exceptions in the log (from first to the last):

eclipse.buildId=unknown
java.version=1.5.0_06
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.sdk.ide -pdelaunch
Command-line arguments:  -product org.eclipse.sdk.ide -data E:\eclipse32/../runtime-EclipseApplication -dev file:E:/eclipse32/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -pdelaunch -os win32 -ws win32 -arch x86

Error
Mon Apr 17 12:07:22 CEST 2006
Error in JDT Core during reconcile

java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2599)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2949)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:2849)
	at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:376)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:172)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2637)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2401)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1121)
	at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:361)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:172)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2637)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1236)
	at org.eclipse.jdt.core.dom.AST.convertCompilationUnit(AST.java:270)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:187)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:229)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:505)
	at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:990)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:131)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:71)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:779)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1120)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:97)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:82)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:145)
	at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:86)
	at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:94)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:75)
	at org.eclipse.jdt.internal.ui.text.JavaReconciler.process(JavaReconciler.java:342)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:204)



eclipse.buildId=unknown
java.version=1.5.0_06
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.sdk.ide -pdelaunch
Command-line arguments:  -product org.eclipse.sdk.ide -data E:\eclipse32/../runtime-EclipseApplication -dev file:E:/eclipse32/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -pdelaunch -os win32 -ws win32 -arch x86

Error
Mon Apr 17 12:07:22 CEST 2006
Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ui".

java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2599)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2949)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:2849)
	at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:376)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:172)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2637)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2401)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1121)
	at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:361)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:172)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2637)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1236)
	at org.eclipse.jdt.core.dom.AST.convertCompilationUnit(AST.java:270)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:187)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:229)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:505)
	at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:990)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:131)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:71)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:779)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1120)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:97)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:82)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:145)
	at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:86)
	at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:94)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:75)
	at org.eclipse.jdt.internal.ui.text.JavaReconciler.process(JavaReconciler.java:342)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:204)


eclipse.buildId=unknown
java.version=1.5.0_06
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.sdk.ide -pdelaunch
Command-line arguments:  -product org.eclipse.sdk.ide -data E:\eclipse32/../runtime-EclipseApplication -dev file:E:/eclipse32/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -pdelaunch -os win32 -ws win32 -arch x86

Error
Mon Apr 17 12:07:22 CEST 2006
Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ui".

java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2599)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2949)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:2849)
	at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:376)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:172)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2637)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2401)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1121)
	at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:361)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:172)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2637)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1236)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:253)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:857)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:631)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:605)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:600)
	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:58)


eclipse.buildId=unknown
java.version=1.5.0_06
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.sdk.ide -pdelaunch
Command-line arguments:  -product org.eclipse.sdk.ide -data E:\eclipse32/../runtime-EclipseApplication -dev file:E:/eclipse32/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -pdelaunch -os win32 -ws win32 -arch x86

Error
Mon Apr 17 12:07:22 CEST 2006
Error in JDT Core during AST creation

java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java:2599)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationFragment(ASTConverter.java:2949)
	at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:2849)
	at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:376)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:172)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2637)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2401)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1121)
	at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:361)
	at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:172)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2637)
	at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1236)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:253)
	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:857)
	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:631)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:605)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:600)
	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:58)
Comment 1 Olivier Thomann CLA 2006-04-17 15:14:51 EDT
I'll investigate.
Comment 2 Olivier Thomann CLA 2006-04-17 21:31:25 EDT
David,

This is a case where the declaring source end of the recovered field declaration (o) is not set.
Comment 3 Olivier Thomann CLA 2006-04-17 23:26:13 EDT
Created attachment 38752 [details]
Regression test
Comment 4 David Audel CLA 2006-04-19 03:54:04 EDT
Created attachment 38901 [details]
Proposed fix
Comment 5 David Audel CLA 2006-04-19 03:56:36 EDT
Philippe - Do you want this fix for 3.2RC2 ?

The declarationEnd of the field needs to be updated when this field contain an anonymous type.
Comment 6 Philipe Mulet CLA 2006-04-19 04:46:22 EDT
+1 for 3.2RC2
Comment 7 David Audel CLA 2006-04-19 04:59:28 EDT
Fix released and test added
  ASTConverterAST3_2#test0646()
Comment 8 Olivier Thomann CLA 2006-04-28 14:29:42 EDT
Verified with I20060427-1600 for 3.2RC2