|
|
Re: Fully qualified name of inner classes [message #554255 is a reply to message #554194] |
Fri, 20 August 2010 19:13 |
Daniel Felix Ferber Messages: 3 Registered: August 2010 |
Junior Member |
|
|
Thanks for pointing out about "binary names".
After spending more time about, I believe that the Java API Specification for the Class.forName method is misleading. That made me suppose incorrectly that Eclipse was producing a wrong fully qualified name. I feel sorry for the confusion.
According to the Java Language Specification, §6.7, Eclipse gives the correct 'fully qualified name'. For my example, eclipse produces "a.b.c.Outer.Inner" that is the expected 'fully qualified name'.
On Java API Specification for Class.forName it states that "Given the fully qualified name for a class or interface (in the same format returned by getName) this method attempts to locate, load, and link the class or interface". However, passing the fully qualified name "a.b.c.Outer.Inner" to Class.forName throws a ClassNotFoundException.
Actually, Class.forName requires the 'binary name' as returned by Class.getName() that according to §13.1 uses '$' instead of a dot. In my example, this would be "a.b.c.Outer$Inner".
|
|
|
Powered by
FUDForum. Page generated in 0.02674 seconds