Bug 29636

Summary: First anonymous type should be named X$1
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Philipe Mulet CLA 2003-01-16 10:34:03 EST
Build 2.1M4

On the following example, the first anonymous (subclass of X) should 
be named X$1. It is currently X$2, where the latter anonymous type get 
generated as X$1.

public class X {
	class A {
	}
	public static void main(String[] arguments) {
		new X(){}.new A(){};
	}
}
Comment 1 Philipe Mulet CLA 2003-01-16 10:36:23 EST
Local type constantpool computation occurs during codegen. As a consequence, 
since the name of the anonymous subclass of A is required first (enclosing 
instance is generated just after new<anonymous-sub-A> bytecode sequence), the 
ordering is wrong.

Can be fixed by moving the naming to the flow analysis where the proper order 
is used to traverse the parse tree.
Comment 2 Philipe Mulet CLA 2003-01-16 10:41:59 EST
Fixed. Constant pool names are now computed during flow analysis.
Comment 3 David Audel CLA 2003-02-12 08:46:54 EST
Verified.