Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

Anonymous and local class names changed in 1.5

Thread view: 
Mike Schilling - 16 Nov 2005 00:37 GMT
Consider the Java class::

   class Outer {
       class Inner {
           Object o = new Object() {
               public String toString() { return "MYOB";}};
           void method() {
               class Local {}
              }
       }
   }

In 1.4.2, there are classes Outer$1.class and Outer$1Local.class.  In 1.5,
these become Outer$Inner$1.class and Outer$Inner$1Local.class.  Can anyone
see a reason for this other than to annoy me (and break the tools I use to
analyze Java classes)?
zero - 16 Nov 2005 00:49 GMT
> Consider the Java class::
>
[quoted text clipped - 12 lines]
> Can anyone see a reason for this other than to annoy me (and break the
> tools I use to analyze Java classes)?

The 1.5 way seems more logical and natural to me.  After all your anonymous
and Local classes are inside Inner inside Outer.  Maybe the guys at Sun
thought so too.
Thomas Hawtin - 16 Nov 2005 00:58 GMT
> In 1.4.2, there are classes Outer$1.class and Outer$1Local.class.  In 1.5,
> these become Outer$Inner$1.class and Outer$Inner$1Local.class.  Can anyone
> see a reason for this other than to annoy me (and break the tools I use to
> analyze Java classes)?

The good news is the JLS3 gives rules to what the format should be, so
shouldn't change too much in the future.

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

Mike Schilling - 16 Nov 2005 06:13 GMT
>> In 1.4.2, there are classes Outer$1.class and Outer$1Local.class.  In
>> 1.5, these become Outer$Inner$1.class and Outer$Inner$1Local.class.  Can
[quoted text clipped - 3 lines]
> The good news is the JLS3 gives rules to what the format should be, so
> shouldn't change too much in the future.

So it does.
(http://java.sun.com/docs/books/jls/third_edition/html/binaryComp.html#13.1)
Thanks!
Roedy Green - 16 Nov 2005 10:19 GMT
On Wed, 16 Nov 2005 00:37:45 GMT, "Mike Schilling"
<mscottschilling@hotmail.com> wrote, quoted or indirectly quoted
someone who said :

>In 1.4.2, there are classes Outer$1.class and Outer$1Local.class.  In 1.5,
>these become Outer$Inner$1.class and Outer$Inner$1Local.class.  Can anyone
>see a reason for this other than to annoy me (and break the tools I use to
>analyze Java classes)?

A bug has been corrected.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Mike Schilling - 17 Nov 2005 21:15 GMT
> On Wed, 16 Nov 2005 00:37:45 GMT, "Mike Schilling"
> <mscottschilling@hotmail.com> wrote, quoted or indirectly quoted
[quoted text clipped - 6 lines]
>
> A bug has been corrected.

I don't see any bug.  The change to local class names in 1.4.2 *was* a
bugfix, IIRC, because the previous names could be ambiguous, but the 1.4.2.
naming convention worked perfectly well.
Roedy Green - 17 Nov 2005 22:22 GMT
On Thu, 17 Nov 2005 21:15:06 GMT, "Mike Schilling"
<mscottschilling@hotmail.com> wrote, quoted or indirectly quoted
someone who said :

>I don't see any bug.  The change to local class names in 1.4.2 *was* a
>bugfix, IIRC, because the previous names could be ambiguous, but the 1.4.2.
>naming convention worked perfectly well.

To me they seem wrong if that description of the names is correct. A
name should reflect something's proper place in the hierarchy. (how
feudal!) In any case the designers were putting the naming rules in
the JLS so they probably decided to tidy them up to make them easier
to explain and easier to defend.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.