Fixes... jk_new_structure
authorvranyj1
Thu, 23 Feb 2012 12:06:34 +0000
branchjk_new_structure
changeset 1377 79eafebce880
parent 1376 c4b2cf1467c3
child 1378 9d64d8357509
Fixes...
src/Java.st
src/JavaClassRegistry.st
src/JavaVM.st
src/Make.proto
src/Make.spec
src/bc.mak
src/libjava.rc
--- a/src/Java.st	Wed Feb 22 22:30:38 2012 +0000
+++ b/src/Java.st	Thu Feb 23 12:06:34 2012 +0000
@@ -1318,12 +1318,14 @@
 
     (sourceFile isNil or:[sourceFile exists not]) ifTrue:[
         sourceFile := aClass sourceFile.
-        sourceFile notNil ifTrue:[
-            package := aClass javaPackageAsDirname.
-            self effectiveSourceDirectories do:[:dir|
-                src := self classSource: sourceFile package: package in: dir.
-                src ifNotNil:[^src]
-            ]
+        sourceFile isNil ifTrue:[
+            "Hmm, hmm...just a guess"    
+            sourceFile := (aClass lastName upTo: $$) , '.java'.
+        ].
+        package := aClass javaPackageAsDirname.
+        self effectiveSourceDirectories do:[:dir|
+            src := self classSource: sourceFile package: package in: dir.
+            src ifNotNil:[^src]
         ]
     ].
 
@@ -1335,7 +1337,7 @@
     "
 
     "Modified: / 27-01-1999 / 20:40:30 / cg"
-    "Modified: / 18-02-2012 / 15:02:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 23-02-2012 / 10:50:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !Java class methodsFor:'starting apps'!
--- a/src/JavaClassRegistry.st	Wed Feb 22 22:30:38 2012 +0000
+++ b/src/JavaClassRegistry.st	Thu Feb 23 12:06:34 2012 +0000
@@ -279,11 +279,11 @@
         classes := loaders at: newClass classLoader put: Dictionary new.
     ].
     classes at: newClass name put: newClass.
-    Smalltalk changed: #newClass with: newClass.
+    "/Smalltalk changed: #newClass with: newClass.
 
     "Created: / 23-10-2011 / 11:53:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 02-11-2011 / 18:40:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified (format): / 20-02-2012 / 23:27:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 23-02-2012 / 11:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaClassRegistry class methodsFor:'documentation'!
--- a/src/JavaVM.st	Wed Feb 22 22:30:38 2012 +0000
+++ b/src/JavaVM.st	Thu Feb 23 12:06:34 2012 +0000
@@ -2628,6 +2628,7 @@
     ExceptionDebug must be set in order to ExceptionDebugPatterns work
 
     ExceptionDebug := true.
+    ExceptionDebug := false.
     ExceptionDebugPatterns add: 'java/lang/SecurityException*'.
     ExceptionDebugPatterns add: 'java/net/ConnectException*'.
     ExceptionDebugPatterns add: 'java/lang/IllegalArgumentException'.
@@ -6833,76 +6834,94 @@
     ^ Java intern:jString
 !
 
-_java_lang_System_arraycopy: nativeContext 
+_java_lang_System_arraycopy: nativeContext
+
     <javanative: 'java/lang/System' name: 'arraycopy'>
-    | srcArray  srcIdx  dstArray  dstIdx  srcArrayCC  dstArrayCC  count  dstEndIdx |
-    srcArray := nativeContext argAt: 1.
-    srcArray isNil ifTrue: [ ^ self throwNullPointerException ].     
-    srcArray isJavaArray ifFalse: [ "mh 29.11.11 dirty ugly hack, pretend that java string is char array"
-    (self canCast:srcArray class to: (self classNamed:'java/lang/String')) ifTrue: [srcArray := srcArray instVarNamed: #value] ifFalse: [
-    ^ self throwArrayStoreException: srcArray] ].
-    srcIdx := nativeContext argAt: 2.
-    dstArray := nativeContext argAt: 3.
-    dstArray isNil ifTrue: [ ^ self throwNullPointerException ].
-    dstArray isJavaArray ifFalse: [ ^ self throwArrayStoreException: dstArray ].
+
+    |srcArray srcIdx dstArray dstIdx srcArrayCC dstArrayCC count dstEndIdx|
+
+    srcArray := nativeContext argAt:1.
+    srcArray isNil ifTrue:[
+        ^ self throwNullPointerException
+    ].
+    srcArray isJavaArray ifFalse:[
+        ^ self throwArrayStoreException:srcArray
+    ].
+    srcIdx := nativeContext argAt:2.
+    dstArray := nativeContext argAt:3.
+    dstArray isNil ifTrue:[
+        ^ self throwNullPointerException
+    ].
+    dstArray isJavaArray ifFalse:[
+        ^ self throwArrayStoreException:dstArray
+    ].
+
     srcArrayCC := srcArray class javaComponentClass.
     dstArrayCC := dstArray class javaComponentClass.
-    srcArrayCC isJavaPrimitiveType == dstArrayCC isJavaPrimitiveType ifTrue: [
-        srcArrayCC isJavaPrimitiveType ifTrue: [
-            srcArrayCC ~~ dstArrayCC ifTrue: [ ^ self throwArrayStoreException: dstArray ]
-        ].
-    ] ifFalse: [ ^ self throwArrayStoreException: dstArray ].
-    dstIdx := nativeContext argAt: 4.
-    count := nativeContext argAt: 5.
-    count < 0 ifTrue: [
-        ^ self throwArrayIndexOutOfBoundsException: (srcIdx + count - 1)
-    ].
-    ((srcIdx < 0) or: [ srcIdx + count > srcArray size ]) ifTrue: [
-        srcArray size == 0 ifTrue: [
-            srcArray isVariable ifFalse: [ ^ self throwArrayStoreException: srcArray ]
-        ].
-        ^ self throwArrayIndexOutOfBoundsException: (srcIdx + count - 1)
-    ].
-    ((dstIdx < 0) or: [ dstIdx + count > dstArray size ]) ifTrue: [
-        dstArray size == 0 ifTrue: [
-            dstArray isVariable ifFalse: [ ^ self throwArrayStoreException: dstArray ]
-        ].
-        ^ self throwArrayIndexOutOfBoundsException: (dstIdx + count - 1)
-    ].
+
+    srcArrayCC isJavaPrimitiveType == dstArrayCC isJavaPrimitiveType 
+        ifTrue:
+            [srcArrayCC isJavaPrimitiveType
+                ifTrue:
+                    [srcArrayCC ~~ dstArrayCC ifTrue:
+                        [^ self throwArrayStoreException:dstArray]].
+            ]
+        ifFalse:
+            [^ self throwArrayStoreException:dstArray].
+
+    dstIdx := nativeContext argAt:4.
+    count := nativeContext argAt:5.
+
+    count < 0 ifTrue:[
+        ^ self throwArrayIndexOutOfBoundsException:(srcIdx + count - 1)        
+    ].
+
+    ((srcIdx < 0) or:[srcIdx + count > srcArray size]) ifTrue:[
+        srcArray size == 0 ifTrue:[
+            srcArray isVariable ifFalse:[
+                ^ self throwArrayStoreException:srcArray
+            ]
+        ].
+        ^ self throwArrayIndexOutOfBoundsException:(srcIdx + count - 1)
+    ].
+    ((dstIdx < 0) or:[dstIdx + count > dstArray size]) ifTrue:[
+        dstArray size == 0 ifTrue:[
+            dstArray isVariable ifFalse:[
+                ^ self throwArrayStoreException:dstArray
+            ]
+        ].
+        ^ self throwArrayIndexOutOfBoundsException:(dstIdx + count - 1)
+    ].
+
     dstEndIdx := dstIdx + count.
-    dstIdx := dstIdx + 1.
-    srcIdx := srcIdx + 1.
-    (srcArray class isBytes and: [ dstArray class isBytes ]) ifTrue: [
-        dstArray 
-            replaceBytesFrom: dstIdx
-            to: dstEndIdx
-            with: srcArray
-            startingAt: srcIdx.
-    ] ifFalse: [
-        dstArrayCC isJavaPrimitiveType ifFalse: [
+    dstIdx := dstIdx + 1.       "/ ST uses 1-based indexing
+    srcIdx := srcIdx + 1.       "/ ST uses 1-based indexing
+
+
+
+    (srcArray class isBytes and:[dstArray class isBytes]) ifTrue:[
+        dstArray replaceBytesFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
+    ] ifFalse:[
+        dstArrayCC isJavaPrimitiveType ifFalse:[
             "Copy from array iff src=dst to avoid overwriting a data when copying"
-            srcArray == dstArray ifTrue: [ srcArray := srcArray copy ].
-            1 to: count do: [
-                :i | 
+            srcArray == dstArray ifTrue:[srcArray := srcArray copy].
+            1 to: count do:[:i|
                 | obj |
-                obj := srcArray at: srcIdx + i - 1.
-                (obj notNil and: [ (self canCast: obj class to: dstArrayCC) not ]) ifTrue: [
-                    ^ self throwArrayStoreException: dstArray
+
+                obj := srcArray at:srcIdx + i - 1.
+
+                (obj notNil and:[(self canCast: obj class to: dstArrayCC) not]) ifTrue:[
+                    ^ self throwArrayStoreException:dstArray
                 ].
-                dstArray at: dstIdx + i - 1 put: (srcArray at: srcIdx + i - 1)
+                dstArray at: dstIdx + i - 1 put: (srcArray at:srcIdx + i - 1)
             ]
-        ] ifTrue: [
-            dstArray 
-                replaceFrom: dstIdx
-                to: dstEndIdx
-                with: srcArray
-                startingAt: srcIdx.
+        ] ifTrue:[
+            dstArray replaceFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
         ]
     ].
     ^ nil.
 
     "Modified: / 08-09-2011 / 15:25:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 29-11-2011 / 12:17:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 !
 
 _java_lang_System_currentTimeMillis: nativeContext
--- a/src/Make.proto	Wed Feb 22 22:30:38 2012 +0000
+++ b/src/Make.proto	Thu Feb 23 12:06:34 2012 +0000
@@ -1,7 +1,7 @@
 # $Header$
 #
 # DO NOT EDIT
-# automagically generated from the projectDefinition: stx_libjava at 2012-02-22 22:28:11.486.
+# automagically generated from the projectDefinition: stx_libjava at 2012-02-23 12:03:27.142.
 #
 # Warning: once you modify this file, do not rerun
 # stmkmp or projectDefinition-build again - otherwise, your changes are lost.
--- a/src/Make.spec	Wed Feb 22 22:30:38 2012 +0000
+++ b/src/Make.spec	Thu Feb 23 12:06:34 2012 +0000
@@ -1,7 +1,7 @@
 # $Header$
 #
 # DO NOT EDIT
-# automagically generated from the projectDefinition: stx_libjava at 2012-02-22 22:28:09.376.
+# automagically generated from the projectDefinition: stx_libjava at 2012-02-23 12:03:25.659.
 #
 # Warning: once you modify this file, do not rerun
 # stmkmp or projectDefinition-build again - otherwise, your changes are lost.
--- a/src/bc.mak	Wed Feb 22 22:30:38 2012 +0000
+++ b/src/bc.mak	Thu Feb 23 12:06:34 2012 +0000
@@ -1,7 +1,7 @@
 # $Header$
 #
 # DO NOT EDIT
-# automagically generated from the projectDefinition: stx_libjava at 2012-02-22 22:28:12.634.
+# automagically generated from the projectDefinition: stx_libjava at 2012-02-23 12:03:28.693.
 #
 # Warning: once you modify this file, do not rerun
 # stmkmp or projectDefinition-build again - otherwise, your changes are lost.
--- a/src/libjava.rc	Wed Feb 22 22:30:38 2012 +0000
+++ b/src/libjava.rc	Thu Feb 23 12:06:34 2012 +0000
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\nCopyright Jan Vrany, Jan Kurs and Marcel Hlopko\b          SWING Research Group, Czech Technical University In Prague\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.1.1\0"
-      VALUE "ProductDate", "Wed, 22 Feb 2012 22:29:49 GMT\0"
+      VALUE "ProductDate", "Thu, 23 Feb 2012 12:05:38 GMT\0"
     END
 
   END