Re: [jchevm] class loader questions

2006-05-22 Thread Mikhail Fursov

May be this is synthetic field (inner-parent reference)?

Check java asm for this test:

public class Test {
   Object field;
   public class Inner {
   Inner() {
   field = null;
   }
   }
}


public class Test$Inner extends java.lang.Object{
Test$Inner(Test);
 Code:
  0:   aload_0
  1:   invokespecial   #1; //Method java/lang/Object.init:()V
  4:   aload_0
  5:   aload_1
  6:   putfield#2; //Field this$0:LTest;
  9:   aload_1
  10:  aconst_null
  11:  putfield#3; //Field Test.field:Ljava/lang/Object;
  14:  return


On 5/22/06, Weldon Washburn [EMAIL PROTECTED] wrote:







--
Mikhail Fursov
Intel Middleware Products Division


Re: [jchevm] class loader questions

2006-05-22 Thread Mikhail Fursov

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:ifnonnull18
  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:goto21
  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 [EMAIL PROTECTED] wrote:



--
Mikhail Fursov
Intel Middleware Products Division


Re: [jchevm] class loader questions

2006-05-22 Thread Pavel Pervov

Method class$ is synthetic and is produced by the Java compiler for some
class which references some class by the construct some class name.class
in its method' code.
For example, the code
---
Class c1 = Object.class;
---
will produce the following Java assembly for method class$
---
Method name:class$ static Signature: 26=(java.lang.String)java.lang.Class
Attribute Code, length:50, max_stack:3, max_locals:2, code_length:18
 0: aload_0
 1: invokestatic #1=Method java.lang.Class.forName (java.lang.String
)java.lang.Class
 4: areturn
 5: astore_1
 6: new #3=Class java.lang.NoClassDefFoundError
 9: dup
10: aload_1
11: invokevirtual #4=Method
java.lang.ClassNotFoundException.getMessage()java.lang.String
14: invokespecial #5=Method java.lang.NoClassDefFoundError.init (
java.lang.String)void
17: athrow
Exceptions (count: 1):
 start: 0, end: 4, handler: 5, type: 2=java.lang.ClassNotFoundException
Attribute LineNumberTable, length:6, count: 1
 line: 4 at pc: 0
Attribute Synthetic, length:0
---

On 5/22/06, Weldon Washburn [EMAIL PROTECTED] wrote:


There is a problem in the early boot stage with the method class$
from the current version of java/lang/Character.



What is exact problem you are experiencing with this method? How did you get
to the fact it is related to java/lang/Character?

Pavel Pervov,
Intel Middleware Products Division.


[jchevm] class loader questions

2006-05-21 Thread Weldon Washburn

All,

I am in the process of moving gnuclasspathadapter to a much new
version of Harmony Class Library.  I did an svn update two days ago.

There is a problem in the early boot stage with the method class$
from the current version of java/lang/Character.  I have looked at
java/lang/Character.class for a method called, class$ and can't find
any evidence of it.  Does anyone have any suggestions?  Could class$
somehow be related to inner classes??

My next step is to use the debugger to watch the class loader load
method class$.

--
Weldon Washburn
Intel Middleware Products Division

-
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]