JavaClass.st
branchdevelopment
changeset 2077 31f8b995905e
parent 2069 75d40b7b986f
child 2380 9195eccdcbd9
--- a/JavaClass.st	Sat Feb 16 12:33:02 2013 +0100
+++ b/JavaClass.st	Sat Feb 16 16:15:51 2013 +0000
@@ -1887,6 +1887,77 @@
     ^nil.
 
     "Created: / 17-03-2012 / 16:41:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+lookupMethodFor:selector
+    |method cls sel queue |
+
+    sel := selector asSymbolIfInterned.
+    sel notNil ifTrue:[
+        queue := OrderedCollection with: self.
+        [ queue isEmpty ] whileFalse:[
+            cls := queue removeFirst.
+            method := cls compiledMethodAt:sel.
+            method notNil ifTrue:[ ^ method ].
+            cls isInterface ifFalse:[
+                cls superclass ~~ JavaObject ifTrue:[queue add: cls superclass]
+            ].
+            queue addAll: cls interfaces.
+        ].
+    ].
+    "/cls ifNotNil:[^super lookupMethodFor: selector].
+    ^ nil
+
+    "Modified: / 19-10-2011 / 17:19:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+performStatic:selector
+    "send a static message, without args."
+
+    |javaMethod sel|
+
+    sel := selector asSymbolIfInterned.
+    sel notNil ifTrue:[
+	javaMethod := methodDictionary at:sel.
+	javaMethod notNil ifTrue:[
+	    javaMethod isStatic ifTrue:[
+		^ javaMethod
+		    valueWithReceiver:self
+		    arguments:#()
+	    ]
+	].
+    ].
+
+    ^ self doesNotUnderstand:(Message selector:selector)
+
+    "Modified: / 15.1.1998 / 00:31:27 / cg"
+    "Created: / 12.11.1998 / 16:29:20 / cg"
+!
+
+performStatic:selector with:arg
+    "send a static message, with one args."
+
+    |javaMethod sel|
+
+    sel := selector asSymbolIfInterned.
+    sel notNil ifTrue:[
+	javaMethod := methodDictionary at:sel.
+	javaMethod notNil ifTrue:[
+	    javaMethod isStatic ifTrue:[
+		^ javaMethod
+		    valueWithReceiver:self
+		    arguments:(Array with:arg)
+		    selector:selector
+		    search:nil
+		    sender:nil
+	    ]
+	].
+    ].
+
+    ^ self doesNotUnderstand:(Message selector:selector argument:arg)
+
+    "Modified: / 15.1.1998 / 00:31:27 / cg"
+    "Created: / 10.12.1998 / 21:50:29 / cg"
 ! !