--- a/JavaVM.st Sat Sep 14 15:48:03 2013 +0100
+++ b/JavaVM.st Sun Sep 15 01:02:01 2013 +0100
@@ -2568,7 +2568,7 @@
self assert: (binaryName includes: $.) not.
self booted ifFalse: [
"class loaders allowed after vm boot, until then, only primordial"
- class := self usePrimordialCLToLoadClassNamed: binaryName.
+ class := self loadClassNamed: binaryName usingClassLoader: nil.
self assert:(class notNil)
message:'Couldnt load class ' , binaryName , ' while booting Java VM'.
class.
@@ -2577,13 +2577,17 @@
message:'Java VM is not booted and we are not using primordial class loader to load: ' , className.
(Java release bootClassPathIncludesClassNamed: className) ifTrue: [
"we will use primordial class loader for classes in rt.jar etc"
- class := self usePrimordialCLToLoadClassNamed: binaryName.
+ class := self loadClassNamed: binaryName usingClassLoader: nil.
self assert:(class notNil)
message:'Class ' , binaryName , ' is supposed to be in boot classpath, but we couldnt load it'.
class.
] ifFalse: [
(Java release extDirsIncludesClassNamed: binaryName) ifTrue: [
- class := self useExtCLToLoadClassNamed: binaryName.
+ | ext |
+
+ ext := self extClassLoader.
+ self assert: ext notNil message: 'Have to use ext class loader but does not exists'.
+ class := self loadClassNamed: binaryName usingClassLoader: ext.
self assert:(class notNil)
message:'Class ' , binaryName , ' is supposed to be in java.ext,dirs, but we couldnt load it'.
class.
@@ -2595,8 +2599,7 @@
message:'We needed system class loader, but its not loaded yet'.
classLoaderEnsured := self systemClassLoader
] ifFalse: [ classLoaderEnsured := classLoader ].
- class := self useUserDefinedCL: classLoaderEnsured
- toLoadClassNamed: binaryName.
+ class := self loadClassNamed: binaryName usingClassLoader: classLoaderEnsured.
class isNil ifTrue: [
Logger
log: 'Even ' , classLoader printString , ' was not able to load class '
@@ -2619,7 +2622,7 @@
"Created: / 21-10-2011 / 12:01:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
"Modified: / 02-11-2011 / 16:49:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 07-05-2013 / 12:27:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 14-09-2013 / 23:12:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
classForName: className definedBy: classLoader ifAbsentPut: aBlock
@@ -2719,48 +2722,30 @@
"Modified: / 30-10-2011 / 14:02:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-!JavaVM class methodsFor:'class loading'!
-
-useExtCLToLoadClassNamed: className
- | ecl class |
- ecl := self extClassLoader.
- self assert:(ecl notNil)
- message:'we want to use ExtClassLoader, but its not loaded yet'.
- class := ecl
- perform: #'loadClassInternal(Ljava/lang/String;)Ljava/lang/Class;'
- with: (Java as_String: (className asDottedJavaClassName)).
- self assert:(class notNil)
- message:'we tried to load class ' , className
- , ' using ExtClassLoader and we failed:)'.
- class := JavaVM classForJavaClassObject: class.
- class classLoader: ecl.
+!JavaVM class methodsFor:'class loading/unloading'!
+
+loadClassNamed: className usingClassLoader: classLoader
+ "Load class with given `className` using given `classLoader`. If
+ `classLoader` is nil (i.e., primordial class loader), load
+ the class ourselfs"
+
+ | class |
+
+ JavaClassReader classLoaderQuerySignal answer: classLoader do: [
+ classLoader isNil ifTrue:[
+ "/ Primordial load...
+ class := JavaClassReader readClass: className classPath: Java release bootClassPath
+ ] ifFalse:[
+ class := classLoader
+ perform: #'loadClassInternal(Ljava/lang/String;)Ljava/lang/Class;'
+ with: (Java as_String: (className asDottedJavaClassName)).
+ class := self classForJavaClassObject: class.
+ ].
+ ].
^ class.
- "Created: / 02-11-2011 / 13:48:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-!
-
-usePrimordialCLToLoadClassNamed: className
- | class |
- JavaClassReader classLoaderQuerySignal answer: nil do: [
- class := JavaClassReader readClass: className classPath: Java release bootClassPath
- ].
- ^ class
-
- "Modified: / 02-11-2011 / 17:28:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 23-01-2013 / 15:18:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-useUserDefinedCL: classLoader toLoadClassNamed: className
- | classObject class |
- classObject := classLoader
- perform: #'loadClassInternal(Ljava/lang/String;)Ljava/lang/Class;'
- with: (Java as_String: (className asDottedJavaClassName)).
- class := self classForJavaClassObject: classObject.
- class javaMirror getClassLoader isNil ifTrue: [self breakPoint:#mh].
- ^ class.
-
- "Created: / 02-11-2011 / 16:20:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
- "Modified: / 22-08-2012 / 12:57:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 14-09-2013 / 23:06:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 15-09-2013 / 00:17:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaVM class methodsFor:'debugging support'!
@@ -2815,12 +2800,15 @@
ExceptionDebugPatterns add: 'java/lang/InstantiationException'.
ExceptionDebugPatterns add: 'java/lang/RuntimeException'.
ExceptionDebugPatterns add: 'java/lang/ClassCastException'.
+ ExceptionDebugPatterns add: 'java/lang/IllegalAccess*'.
+
ExceptionDebug := true.
"
"Created: / 25-02-2011 / 08:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 14-09-2013 / 23:59:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaVM class methodsFor:'debugging-dumping'!