Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Fully qualified name of inner classes
Fully qualified name of inner classes [message #554037] Thu, 19 August 2010 19:21 Go to next message
Daniel Felix Ferber is currently offline Daniel Felix FerberFriend
Messages: 3
Registered: August 2010
Junior Member
When I point the mouse over a inner class declaration, hit right button, then "copy fully qualified name", I get a string like "a.b.c.Outer.Inner" into the clipboard.

I wonder if the correct fully qualified name shouldn't be "a.b.c.Outer$Inner"?

Considering Java documentation, specially the javadocs for Class.forName(), the former fully qualified name is not valid. I would expect that the concept of "full qualified name" should be uniform between the Eclipse IDE and the JDK.
Re: Fully qualified name of inner classes [message #554194 is a reply to message #554037] Fri, 20 August 2010 13:34 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Daniel Felix Ferber wrote:
> When I point the mouse over a inner class declaration, hit right
> button, then "copy fully qualified name", I get a string like
> "a.b.c.Outer.Inner" into the clipboard.
>
> I wonder if the correct fully qualified name shouldn't be
> "a.b.c.Outer$Inner"?
>
> Considering Java documentation, specially the javadocs for
> Class.forName(),
I cannot see anything about '$' in that Javadoc and also not in the JLS3
(apart from the definition of class names for binary nested types in
section 13.1). Please correct me if I'm wrong.

Dani
> the former fully qualified name is not valid. I would expect that the
> concept of "full qualified name" should be uniform between the Eclipse
> IDE and the JDK.
Re: Fully qualified name of inner classes [message #554255 is a reply to message #554194] Fri, 20 August 2010 19:13 Go to previous message
Daniel Felix Ferber is currently offline Daniel Felix FerberFriend
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".
Previous Topic:How to locate inner classes within JDT?
Next Topic:JPA Annotations
Goto Forum:
  


Current Time: Thu Apr 25 08:11:16 GMT 2024

Powered by FUDForum. Page generated in 0.02674 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top