On Fri, 26 Aug 2005 20:39:17 +0100, Thomas Hawtin
<> wrote or quoted :
>I don't think you should depend upon your decompiler being accurate.
>javap -c is the way to go. You can see that the actual byte code is
>different from what your decompiler is claiming.
You are such a clever character. You are right yet again. The
compiler indeed does the static field inits AFTER the constructor
calls. If it reversed the order, the way DJ decompiles it, Java would
have no problem with static references in constructors.
Here is the Javap decompilation of Final.java
javap -c Final
Compiled from "Final.java"
final class Final extends java.lang.Enum{
public static final Final X;
public static final Final[] values();
Code:
0: getstatic #1; //Field $VALUES:[LFinal;
3: invokevirtual #2; //Method
"[LFinal;".clone

)Ljava/lang/Object;
6: checkcast #3; //class "[LFinal;"
9: areturn
public static Final valueOf(java.lang.String);
Code:
0: ldc_w #4; //class Final
3: aload_0
4: invokestatic #5; //Method
java/lang/Enum.valueOf

Ljava/lang/Class;Lj
ava/lang/String

Ljava/lang/Enum;
7: checkcast #4; //class Final
10: areturn
static {};
Code:
0: new #4; //class Final
3: dup
4: ldc #7; //String X
6: iconst_0
7: invokespecial #8; //Method "<init>"

Ljava/lang/String;I)V
10: putstatic #9; //Field X:LFinal;
13: iconst_1
14: anewarray #4; //class Final
17: dup
18: iconst_0
19: getstatic #9; //Field X:LFinal;
22: aastore
23: putstatic #1; //Field $VALUES:[LFinal;
26: iconst_2
27: iconst_1
28: invokestatic #10; //Method java/lang/Math.min

II)I
31: putstatic #11; //Field x:I
34: return
}
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.