(none) jk_new_structure
authorvranyj1
Sun, 30 Oct 2011 22:38:19 +0000
branchjk_new_structure
changeset 1063 380dfb73097a
parent 1062 69aac7194016
child 1064 13d6b131a9c1
(none)
src/JavaDescriptor.st
src/JavaVM.st
--- a/src/JavaDescriptor.st	Sun Oct 30 21:13:43 2011 +0000
+++ b/src/JavaDescriptor.st	Sun Oct 30 22:38:19 2011 +0000
@@ -309,8 +309,14 @@
     | clsName out |
 
     stream next. "/eat $L.
-    out := String new writeStream.
-    [ stream peek ~~ $; and:[stream peek ~~ $< ]] whileTrue:[out nextPut: stream next].
+    out := String new writeStream.    
+    [ stream peek ~~ $; and:[stream peek ~~ $< ]] whileTrue:[
+        | c |
+
+        c := stream next.
+        c isNil ifTrue:[exceptionBlock value. ^nil].
+        out nextPut: stream next
+    ].
     clsName := out contents.
     stream peek == $< ifTrue:[
         self readTypeVariableFrom: stream onError: exceptionBlock
--- a/src/JavaVM.st	Sun Oct 30 21:13:43 2011 +0000
+++ b/src/JavaVM.st	Sun Oct 30 22:38:19 2011 +0000
@@ -5211,7 +5211,7 @@
     nm := Java as_ST_String: (aJavaContext argAt: 1).
 
     "Using Class.forName() to get a primitive type is not allowed"
-    (JavaDescriptor baseTypes includesKey: nm) ifTrue: [
+    (nm size == 1 and:[JavaDescriptor baseTypes includesKey: nm first]) ifTrue: [
         ^ self throwClassNotFoundException: nm .
     ].
     (JavaDescriptor baseTypesByTypeName includesKey: nm) ifTrue: [
@@ -5223,9 +5223,15 @@
     JavaClassReader classLoaderQuerySignal answer: loader
         do: [
             (nm first == $[) ifTrue: [
+                | nms |
+
+                nms := nm readStream.
                 descriptor := JavaDescriptor 
-                                readFrom: nm readStream 
+                                readFrom: nms 
                                 onError:[ ^ self throwClassNotFoundException: nm ].
+                nms atEnd ifFalse:[
+                    ^ self throwClassNotFoundException: nm
+                ].
                 class := descriptor javaClass.
             ] ifFalse: [ class := self classForName: nm ]
         ].
@@ -5237,7 +5243,7 @@
     ^ JavaVM javaClassObjectForClass: class.
 
     "Created: / 24-11-2010 / 09:03:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 30-10-2011 / 20:13:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 30-10-2011 / 23:30:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 _java_lang_Class_getClassLoader0: aJavaContext
@@ -5252,6 +5258,7 @@
     cls := self reflection classForJavaClassObject:jClass.
     cls isJavaPrimitiveType ifTrue:[^nil].
     [ cls isJavaArrayClass ] whileTrue:[cls := cls javaComponentClass].
+    cls isJavaPrimitiveType ifTrue:[^nil].
     loader := cls classLoader.
 "/    loader isNil ifTrue:[
 "/        cls := (Java at:'java/lang/ClassLoader').
@@ -5261,7 +5268,7 @@
 
     "Created: / 25-10-2010 / 22:49:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 28-01-2011 / 15:18:54 / Marcel Hlopko <hlopik@gmail.com>"
-    "Modified: / 14-08-2011 / 23:17:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 30-10-2011 / 23:24:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 _java_lang_Class_getComponentType: nativeContext