aspose file tools*
The moose likes Java in General and the fly likes Is compiling anonymous classes in jdk1.5.0 beta different? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Is compiling anonymous classes in jdk1.5.0 beta different?" Watch "Is compiling anonymous classes in jdk1.5.0 beta different?" New topic
Author

Is compiling anonymous classes in jdk1.5.0 beta different?

Keith Thompson
Greenhorn

Joined: May 11, 2004
Posts: 22
I am compiling a java program with jdk1.5.0 beta.

I get a compiled class file with this name ==>
className+1.class

(And YES - it executes fine. My question is just related to the naming convention for compiled class names in jdk1.5.0).

I guess the "+1" means there is an anonymous class somewhere within my program?

Didn't anonymous class files used to be compiled with a naming convention that ended with a dollar sign "$" like this? ==>
className$.class

thanks,
Keith
[ May 31, 2004: Message edited by: Keith Thompson ]
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

shouldn't you know by a look at your source code, whether you use a anonymous class?

Perhaps it's used for some autoboxing-issues or generic class?


http://home.arcor.de/hirnstrom/bewerbung
Keith Thompson
Greenhorn

Joined: May 11, 2004
Posts: 22
I guess I worded my question wrong. Yes - I am using an anonymous class.

I was just curious if other people agreed with my observations? This has nothing to do with generics or other new features of jdk1.5.0, it is just a plain & simple anonymous class compilation.

This is my observation about anonymous class compilation with jdk1.5.0 beta - >>
///////////////////////

This is the naming convention for compiled anonymous classes with jdk1.4.2:
className.java
className.class
className$1.class


This is the naming convention for compiled anonymous classes WITH jdk1.5.0 beta:
className.java
className.class
className+1.class


do other people agree with this?

thanks,
Keith
[ May 31, 2004: Message edited by: Keith Thompson ]
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
As long as we're on the topic of naming conventions, shouldn't it be ClassName.class?


I've heard it takes forever to grow a woman from the ground
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
yes, the $ in the filenames for inner classes (or maybe just for anonymous ones) as generated by J2SDK 1.5.0 has been changed into a + from the filenames generated by earlier versions.


42
Keith Thompson
Greenhorn

Joined: May 11, 2004
Posts: 22
thanks!


Do you know of any documentation for this? I looked all over but I could not find anything.

thanks!
Keith
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is compiling anonymous classes in jdk1.5.0 beta different?