Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Name$1.class

 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may be an easy one for you guys. I don't have any inner classes in one of my gui classes but during the README.TXT documentation, I found a file "Name$1.class" where Name is the name of the gui class. I don't know how to describe it in the document. Thanks.
[ May 08, 2002: Message edited by: Sai Prasad ]
 
Colin Froggatt
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sai, I think it has probably come from an annonymous inner class which most people use when declaring event handlers. If you have code like this:

then it is probably where it's come from. This creates an annonymous class impl' for the ActionListener.
I'm doing my doc's at the moment and I am only going to list and doc my .java files. I thought (and same from other posts here) that doc'ing the .class files is really overkill and adds very little to report.
hope this helps.
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like I said, I don't have an anonymous inner class defined in the outer class. Every one of my inner class has a name. I agree with you on listing the *.java files. Thanks.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But you do have an inner class there?
Mark
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't find any anonymous inner classes in the souce file. May be I am burning the mid night oil too much. I will try to open my eyes wide and let you know if I find anything...strange....
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not just anonymous. Do you have any other type of inner class?
Mark
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
Ok. Let me provide some more information. In the source file "ReservationUIController.java", I have 6 inner classes with clear class names. I don't have any anonymous inner class inside ReservationUIController class or any of the named inner classes. I don't have any type of inner class inside the 6 named inner classes.
I don't know why the compiled list has ReservationUIController$1.class. Below is the list of *.class files resulted by the compilation of ReservationUIController.java.
-----------
ReservationUIController$SearchMiListener.class
ReservationUIController$CloseMiListener.class
ReservationUIController$ExitMiListener.class
ReservationUIController$ReservationWindowListener.class
ReservationUIController$UserManualMiListener.class
ReservationUIController.class
ReservationUIController$1.class
ReservationUIController$HelpAboutMiListener.class
-----------
I've uploaded my assignment yesterday and it is not critical to get the answer soon. But I like to learn why the generated list has
ReservationUIController$1.class. Thanks again.
[ May 10, 2002: Message edited by: Sai Prasad ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't help you much there because I obviously can't see your code. But don't post the code here, don't want to give other people your code and do their work for them.
But you already know that the only way javac makes a $1 is if there is an anonymous inner class. How about a WindowListener? Just a guess, a stab in the dark.
Mark
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used JAD to decompile the ReservationUIController$1.class. Below is the decompiled code:

Then I decompiled each one of my named inner classes which acts as ActionListener(s). In every
one of those classes, I found a constructor (which I didn't code) as:

In the code above, ReservationWindowListener is the defined as the inner class in ReservationUIController.
I guess this is the new way (since J2SDK1.4) of calling the constructor of the inner classes. But why? I like to know the reason if someone can explain. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic