- JavaClassReader: do not uodate changes when loading .class file jk_new_structure
authorvranyj1
Sat, 19 Nov 2011 12:12:10 +0000
branchjk_new_structure
changeset 1139 d7a367bb8ca1
parent 1138 1159f37c14f0
child 1140 655237a7031b
- JavaClassReader: do not uodate changes when loading .class file - JavaClass, SmalltalkLookup, JavaLookup: small fixes (add ilc param)
src/JavaClass.st
src/JavaClassReader.st
src/JavaLookup.st
src/SmalltalkLookup.st
src/extensions.st
src/stx_libjava.st
--- a/src/JavaClass.st	Sat Nov 19 10:44:58 2011 +0000
+++ b/src/JavaClass.st	Sat Nov 19 12:12:10 2011 +0000
@@ -180,8 +180,8 @@
             s nextPutAll:aPart
         ].
         Metaclass confirmationQuerySignal answer:false do:[
-            Class updateChangeFileQuerySignal answer:false do:[
-                ns := NameSpace fullName:(s contents).
+            Class withoutUpdatingChangesDo:[
+                ns := JavaPackage fullName:(s contents).
             ]
         ]
     ].
@@ -196,7 +196,7 @@
 
     "Created: / 15-04-1996 / 15:52:55 / cg"
     "Modified: / 03-01-1998 / 22:32:25 / cg"
-    "Modified: / 26-11-2010 / 19:00:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-11-2011 / 12:03:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 name:aString
@@ -565,7 +565,8 @@
                 directedTo: class
                 for: receiver
                 withArguments: args
-                from: sender.
+                from: sender
+                ilc: nil.
 
         method ifNotNil:
         [   | boxedArgs |
@@ -576,6 +577,7 @@
         ^ aBlock value.
 
     "Created: / 19-09-2011 / 23:33:06 / Jan Kurs <kursjan@fit.cvut.cz>"
+    "Modified: / 19-11-2011 / 12:38:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaClass class methodsFor:'signature parsing'!
--- a/src/JavaClassReader.st	Sat Nov 19 10:44:58 2011 +0000
+++ b/src/JavaClassReader.st	Sat Nov 19 12:12:10 2011 +0000
@@ -614,18 +614,20 @@
         classBeingLoaded setName: thisClassName asSymbol.
     ] ifFalse: [
         "/ a java class
-        classBeingLoaded := JavaClass fullName: thisClassName numStatic: nStatic.
-        classBeingLoaded classLoader: self class classLoaderQuerySignal query.        
-        fields := fields select: [:f | f isStatic not ].
-        JavaClass setInstanceVariableStringFromFields: staticFields
-            in: classBeingLoaded class.
-        classBeingLoaded setStaticFields: staticFields.
-        classBeingLoaded initializeStaticFields.
-        classBeingLoaded setAccessFlags: access_flags.
-        classBeingLoaded setSuperclass: super_class.
-        classBeingLoaded setConstantPool: constants.
-        classBeingLoaded setFields: fields.
-        classBeingLoaded setInterfaces: interfaces.
+        Class withoutUpdatingChangesDo:[
+            classBeingLoaded := JavaClass fullName: thisClassName numStatic: nStatic.
+            classBeingLoaded classLoader: self class classLoaderQuerySignal query.        
+            fields := fields select: [:f | f isStatic not ].
+            JavaClass setInstanceVariableStringFromFields: staticFields
+                in: classBeingLoaded class.
+            classBeingLoaded setStaticFields: staticFields.
+            classBeingLoaded initializeStaticFields.
+            classBeingLoaded setAccessFlags: access_flags.
+            classBeingLoaded setSuperclass: super_class.
+            classBeingLoaded setConstantPool: constants.
+            classBeingLoaded setFields: fields.
+            classBeingLoaded setInterfaces: interfaces.
+        ]
     ].
     
     "/
@@ -658,7 +660,7 @@
     "Modified: / 15-10-2010 / 17:37:38 / Jan Kurs <kurs.jan@post.cz>"
     "Modified: / 28-01-2011 / 15:09:48 / Marcel Hlopko <hlopik@gmail.com>"
     "Modified: / 18-05-2011 / 15:30:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 30-10-2011 / 22:05:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-11-2011 / 12:00:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 readStream:aStream ignoring:classesBeingLoaded
--- a/src/JavaLookup.st	Sat Nov 19 10:44:58 2011 +0000
+++ b/src/JavaLookup.st	Sat Nov 19 12:12:10 2011 +0000
@@ -131,7 +131,7 @@
 
 !JavaLookup methodsFor:'lookup'!
 
-lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext
+lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext ilc: ilc
     "
         As a courtesy to a Smalltalker, try to map smalltalk selectors to a java ones.
         Returns JavaMethodDescriptor or nil.
@@ -154,6 +154,7 @@
     "Modified: / 29-08-2011 / 20:38:21 / kursjan"
     "Modified: / 20-09-2011 / 00:03:48 / Jan Kurs <kursjan@fit.cvut.cz>"
     "Modified (format): / 25-09-2011 / 21:08:45 / Jan Kurs <kursjan@fit.cvut.cz>"
+    "Created: / 19-11-2011 / 13:03:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaLookup methodsFor:'matching'!
--- a/src/SmalltalkLookup.st	Sat Nov 19 10:44:58 2011 +0000
+++ b/src/SmalltalkLookup.st	Sat Nov 19 12:12:10 2011 +0000
@@ -139,31 +139,42 @@
 
 !SmalltalkLookup methodsFor:'lookup'!
 
-lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext
-    | m jm sm |
+lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext ilc: ilc
+    | m jm sm cls |
     "perform standard lookup"
-    m := Lookup builtin lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext.
-    m ifNotNil: [ ^ m ].
+    m := super lookupMethodForSelector:selector directedTo:initialSearchClass for:aReceiver withArguments:argArrayOrNil from:sendingContext ilc: ilc.
+    m notNil ifTrue: [ ^ m ].
 
     "nothing found? Maybe selector is JavaSelector"
+    (selector includes: $() ifFalse:[
+        "Hmm, not a Java selector..."
+        ^nil.
+    ].
     jm := self descriptorForJavaSelector: selector.
 
     sm := (JavaTypeBox typeBoxForSmalltalkClass: initialSearchClass) javaMessageToSmalltalk: jm.
-    sm ifNotNil: [ ^ sm ].
+    sm notNil ifTrue: [ ^ sm ].
 
-    (initialSearchClass allSelectors) do: [:s || sm |
-        sm := self descriptorForSmalltalkSelector: s.
-        "find methods with same name and either static or non-static"
-        ((sm name = jm name) and: [sm argSize = jm argSize]) ifTrue: [
-            ^ sm 
-                returnType: jm returnType;
-                yourself.
-        ]                
+    cls := initialSearchClass.
+    [ cls notNil ] whileTrue:[
+        cls selectorsAndMethodsDo: [:s :m || sm |
+            sm := self descriptorForSmalltalkSelector: s.
+            "find methods with same name and either static or non-static"
+            ((sm name = jm name) and: [sm argSize = jm argSize]) ifTrue: [
+                self error:'lookupMethod... MUST return method or nil, NOTHING else!!!!!!!!'.
+                ^ sm 
+                    returnType: jm returnType;
+                    yourself.
+                "/^m.
+            ]                
+        ].
+        cls := cls superclass.
     ].
     ^ nil.
 
     "Created: / 06-09-2011 / 22:04:04 / Jan Kurs <kursjan@fit.cvut.cz>"
     "Modified: / 09-10-2011 / 22:59:18 / kursjan <kursjan@fit.cvut.cz>"
+    "Created: / 19-11-2011 / 12:37:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !SmalltalkLookup methodsFor:'matching'!
--- a/src/extensions.st	Sat Nov 19 10:44:58 2011 +0000
+++ b/src/extensions.st	Sat Nov 19 12:12:10 2011 +0000
@@ -139,7 +139,8 @@
                 directedTo: class
                 for: receiver
                 withArguments: args
-                from: sender.
+                from: sender
+                ilc: nil.
 
         method ifNotNil:
         [  | unboxedArgs |
@@ -150,6 +151,7 @@
         ^ aBlock value.
 
     "Created: / 28-09-2011 / 11:31:33 / Jan Kurs <kursjan@fit.cvut.cz>"
+    "Modified: / 19-11-2011 / 12:38:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 !Class methodsFor:'method lookup'!
 
--- a/src/stx_libjava.st	Sat Nov 19 10:44:58 2011 +0000
+++ b/src/stx_libjava.st	Sat Nov 19 12:12:10 2011 +0000
@@ -624,7 +624,7 @@
     "Return a SVN revision number of myself.
      This number is updated after a commit"
 
-    ^ "$SVN-Revision:"'1481'"$"
+    ^ "$SVN-Revision:"'1491'"$"
 ! !
 
 !stx_libjava class methodsFor:'file generation'!