JavaObject.st
changeset 33 bef781ce106e
parent 29 eb3367f8fb9b
child 34 edb4800567d5
--- a/JavaObject.st	Thu May 02 15:20:07 1996 +0000
+++ b/JavaObject.st	Thu May 02 16:54:10 1996 +0000
@@ -165,13 +165,26 @@
 !
 
 invoke:selector with:argument
-    "send a message, without args"
+    "send a message, with 1 argument. This method needs more work."
+
+    |method cls argClass jSel|
 
-    |method cls argClass|
-
+    "/
     "/ hard to do - must find a matching method probably
+    "/
     (argument isKindOf:JavaObject) ifTrue:[
         argClass := argument class.
+    ] ifFalse:[
+        "/
+        "/ map to Java:
+        "/   String -> [c
+        "/
+        (argument isMemberOf:String) ifTrue:[
+            jSel := (selector , '([C)V') asSymbolIfInterned.
+            jSel notNil ifTrue:[
+                ^ self invokeJava:jSel with:argument
+            ]
+        ]
     ].
 
     cls := self class.
@@ -179,6 +192,13 @@
         cls methodArray do:[:aMethod |
             aMethod name == selector ifTrue:[
                 aMethod numArgs == 1 ifTrue:[
+                    "/
+                    "/ this is not completely correct:
+                    "/ must look for the best type-match,
+                    "/ (especially: have to look for best match
+                    "/  over whole superclass chain ...)
+                    "/ for now take the first with matching number of args
+                    "/
                     ^ self invokeJavaMethod:aMethod with:argument
                 ]
             ]
@@ -191,7 +211,7 @@
     "
      |stack|
 
-     stack := (Java at:'java/util/Stack') basicNew.
+     stack := (Java at:'java/util/Stack') new.
      stack invoke:#push with:1. 
     "
 ! !
@@ -199,5 +219,5 @@
 !JavaObject class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaObject.st,v 1.2 1996/05/01 16:22:46 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaObject.st,v 1.3 1996/05/02 16:54:10 cg Exp $'
 ! !