harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Fursov" <mike.fur...@gmail.com>
Subject Re: [jchevm] class loader questions
Date Mon, 22 May 2006 11:23:59 GMT
Weldon,
I confused this$ and class$ fields in your example.
Here is another example where class$ method is generated and used:

public class Test2 {
        public static void main(String[] args) {
            Class cls = Test2.class;
        }
}

and javap output is:

public class Test2 extends java.lang.Object{
static java.lang.Class class$Test2;

public Test2();
  Code:
   0:    aload_0
   1:    invokespecial    #6; //Method java/lang/Object."<init>":()V
   4:    return

public static void main(java.lang.String[]);
  Code:
   0:    getstatic    #7; //Field class$Test2:Ljava/lang/Class;
   3:    ifnonnull    18
   6:    ldc    #8; //String Test2
   8:    invokestatic    #9; //Method
class$:(Ljava/lang/String;)Ljava/lang/Class;
   11:    dup
   12:    putstatic    #7; //Field class$Test2:Ljava/lang/Class;
   15:    goto    21
   18:    getstatic    #7; //Field class$Test2:Ljava/lang/Class;
   21:    astore_1
   22:    return

static java.lang.Class class$(java.lang.String);
  Code:
   0:    aload_0
   1:    invokestatic    #1; //Method
java/lang/Class.forName:(Ljava/lang/String;)Ljava/lang/Class;
   4:    areturn
   5:    astore_1
   6:    new    #3; //class NoClassDefFoundError
   9:    dup
   10:    aload_1
   11:    invokevirtual    #4; //Method
java/lang/ClassNotFoundException.getMessage:()Ljava/lang/String;
   14:    invokespecial    #5; //Method
java/lang/NoClassDefFoundError."<init>":(Ljava/lang/String;)V
   17:    athrow
  Exception table:
   from   to  target type
     0     4     5   Class java/lang/ClassNotFoundException


}



On 5/22/06, Mikhail Fursov <mike.fursov@gmail.com> wrote:



-- 
Mikhail Fursov
Intel Middleware Products Division

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message