Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (546)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Rogue class file - Outer$1.class  (Read 2888 times)
0 Members and 1 Guest are viewing this topic.
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Posted 2003-04-24 07:29:38 »

Hey peeps,

Here's a bit of a wierd one for you; I'd be very grateful if anyone can give me a reason why the following happens, could tell me whether or not it's a bug, and whether it has been fixed in the latest JDK - I'm running JDK 1.4.1_01:

1  
2  
3  
4  
5  
6  
7  
8  
public class Outer
{
      private class Inner
      {
      }

      Inner i = new Inner() ;
}


When this class is compiled it produces three class files, Outer.class, Outer$Inner.class and Outer$1.class.  What is Outer$1?  It is generated whenever the class is compiled, but can be deleted without affecting the class' functionality.  When decompiling the three class files together, a single file equivalent to the above is generated - subsequently compiling this file produces the three class files again.

Decompiling just the Outer$1.class file produces the following:

1  
2  
3  
class Outer$1
{
}


Decompiling just the Outer$Inner.class file produces the following:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
private class Outer$Inner
{
      private Outer$Inner()
      {
            super();
      }

      Outer$Inner(Outer$1 outer$1)
      {
            this();
      }
}


So what is that second constructor?  Why can life continue fine without the class existing?  And is this expected behaviour?

Cheers,
Charlie.

Hellomynameis Charlie Dobbie.
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #1 - Posted 2003-04-24 07:45:06 »

That *is* weird  Roll Eyes

When I try in Eclipse, I get the expected 2 classes (so not the Outer$1 class), but using javac I get the weird 3rd one...

Offline sma

Junior Member





« Reply #2 - Posted 2003-04-24 07:53:48 »

1.4.2 beta also generates that $1 class.  Eclipse 2.1 doesn't. The eclipse-generated Outer$Inner class has just one constructor:
1  
2  
3  
4  
Outer$Inner(Outer o) {
  super();
  this$0 = o;
}

javac probably wants to make sure to create a unique method signature but I don't really know why.

.: Truth Until Paradox!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline snak

Senior Newbie




Eu não falo o português


« Reply #3 - Posted 2003-04-24 14:36:14 »

It's a class generated to send information to the CIA.  That's why when you decompile it you dont see anything.  True story
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #4 - Posted 2003-04-24 15:21:20 »

It's a "go between" class that links used methods and variables between the internal and parent classes. Since your example doesn't actually access anything inside internal class or vica-versa, the "go between" is unnecessary. Javac usually generates it anyway. I'll make a bet that Eclipse is using Jikes instead.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #5 - Posted 2003-04-24 18:38:59 »

Ah, good.  I won't worry about it then.

I was developing an ultra-clever DisplayMode filtering class and had a load of anonymous inner classes at one point.  I then removed them all in favour of one named inner class.  But one unnamed class file remained...

I have noticed that it doesn't appear if the inner class is anything but private though.  I must decompile the classes and see what goes on in that case.

Cheers, everyone!

Hellomynameis Charlie Dobbie.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

atombrot (20 views)
2014-08-19 09:29:53

Tekkerue (21 views)
2014-08-16 06:45:27

Tekkerue (21 views)
2014-08-16 06:22:17

Tekkerue (12 views)
2014-08-16 06:20:21

Tekkerue (19 views)
2014-08-16 06:12:11

Rayexar (55 views)
2014-08-11 02:49:23

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (27 views)
2014-08-08 02:01:56

Norakomi (35 views)
2014-08-06 19:49:38

BurntPizza (64 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!