src/JavaVM.st
branchjk_new_structure
changeset 1135 79bdd1501934
parent 1131 ae50e48af044
child 1136 2a94c9946e7e
--- a/src/JavaVM.st	Fri Nov 18 00:07:30 2011 +0000
+++ b/src/JavaVM.st	Fri Nov 18 14:40:56 2011 +0000
@@ -5234,7 +5234,8 @@
     | className  b  off  len  pd  source  bs  cls |
     className := Java as_ST_String: (nativeContext argAt: 1).
      "if name starts with java.* or package is signed by something else and we are not signed, throw security exception" "ClassLoadersTest>>testEyeOpeningClassLoaderLoadObject"
-    (className startsWith: 'java.') ifTrue: [       
+     "18.11. mh revised - they really test it against java., totally ignoring boot class path.. That surpsised me"
+    (className startsWith: 'java.') ifTrue: [
         self throwSecurityExceptionWith: 'className=' , className
     ].
     cls := ClassRegistry 
@@ -5266,6 +5267,7 @@
 
     "Modified: / 30-10-2011 / 21:46:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 02-11-2011 / 22:10:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified (comment): / 18-11-2011 / 15:21:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 !
 
 _java_lang_ClassLoader_findBootstrapClass: nativeContext 
@@ -5326,59 +5328,41 @@
 _java_lang_ClassLoader_resolveClass0: nativeContext 
     <javanative: 'java/lang/ClassLoader' name: 'resolveClass0'>
     "resolve a new class as previously created by defineClass0"
-    
-    | jClassLoader  jCls  cls  anyUnresolved |
+    "or to be more precise - link class"
+    
+    | jClassLoader  jCls  cls |
+    Logger log: 'resolve class native method called - going to resolve whole constant pool - keep your fingers crossed' severity:#debug facility:#JVM.
     jClassLoader := nativeContext receiver.
     jCls := nativeContext argAt: 1.
     jCls isNil ifTrue: [
-        self halt.
+        self throwNullPointerException.
         ^ nil
     ].
     cls := self reflection classForJavaClassObject: jCls.
-    cls isNil ifTrue: [
-        self halt.
-        ^ nil
-    ].
+    self assert: cls notNil.
     JavaClassReader classLoaderQuerySignal answer: jClassLoader
-        do: [
-            "correct this so it works with new resolving"
-            JavaClassReader resolveClass: cls.
-            
-"/        JavaClassReader postLoadActions:true.
-            
-            anyUnresolved := false.
-            cls constantPool do: [
-                :entry | 
-                (entry isMemberOf: JavaUnresolvedClassConstant) ifTrue: [
-                    self halt: 'debugHalt'.
-                    entry preResolve.
-                    self halt: 'debugHalt'.
-                    anyUnresolved := true.
-                ]
-            ]
-        ].
-    anyUnresolved ifTrue: [
-        jClassLoader notNil ifTrue: [
-            "/ any unresolved left -> try resolving with standard loader
-            JavaClassReader classLoaderQuerySignal answer: nil
-                do: [
-                    cls constantPool do: [
-                        :entry | 
-                        (entry isMemberOf: JavaUnresolvedClassConstant) ifTrue: [
-                            self halt: 'debugHalt'.
-                            entry preResolve.
-                            self halt: 'debugHalt'.
-                        ]
-                    ]
-                ]
-        ].
-    ].
+        do: [ cls resolveAll. ]
+
+    "
+        Links the specified class.  This (misleadingly named) method may be
+        * used by a class loader to link a class.  If the class <tt>c</tt> has
+        * already been linked, then this method simply returns. Otherwise, the
+        * class is linked as described in the Execution chapter of the <a
+        * href=http://java.sun.com/docs/books/jls/>Java Language
+        * Specification</a>.
+        * </p>
+        *
+        * @param  c
+        *         The class to link
+        *
+        * @throws  NullPointerException
+         *          If <tt>c</tt> is <tt>null</tt>."
 
     "Created: / 07-01-1998 / 13:12:27 / cg"
     "Modified: / 20-10-1998 / 19:01:57 / cg"
     "Modified: / 28-01-2011 / 15:28:18 / Marcel Hlopko <hlopik@gmail.com>"
     "Modified: / 14-09-2011 / 22:14:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-11-2011 / 22:10:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 18-11-2011 / 15:31:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 !
 
 _java_lang_Class_desiredAssertionStatus0: aJavaContext