Bug 114266 - name of anonymous inner class in inner class
Summary: name of anonymous inner class in inner class
Status: VERIFIED DUPLICATE of bug 108856
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.1.2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-28 18:32 EDT by Nick Collier CLA
Modified: 2006-01-10 09:47 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 Nick Collier CLA 2005-10-28 18:32:23 EDT
The eclipse compiler compiles an anonymous inner of an inner class as if the
anonymous inner class was part of the enclosing outer class. For example,

public class Foo {
	
	class Bar {
		public ActionListener doSomething() {
			return new ActionListener() {
				public void actionPerformed(ActionEvent evt) {
					System.out.println("foo");
				}
				
			};
		}
	}
	
	public void foo() {}

}

compiles as 3 classes: Foo.class, Foo$Bar.class and Foo$1.class where
Foo$1.class is the anonymous inner class. By contrast javac compiles Foo.class,
Foo$Bar.class, and Foo$Bar$1.class which is, I think, the correct behavior.

This difference in the class name causes problem with XML serialization tools
such as XStream because the eclipse and javac name the class differently.
Comment 1 Olivier Thomann CLA 2005-10-28 18:37:46 EDT
What compliance are you using?
It looks like your are using javac 1.5.
If you use the latest version and you set your compliance to 1.5 it should
behave the same.
Closing as dup of bug 108856.

*** This bug has been marked as a duplicate of 108856 ***
Comment 2 Olivier Thomann CLA 2006-01-10 09:47:38 EST
Verified in M20060109-0800 for 3.1.2