JavaContext.st
changeset 52 1dc41619b6f8
parent 43 2c4ca2eb8d07
child 84 cbc2de53e086
--- a/JavaContext.st	Mon May 06 10:08:19 1996 +0000
+++ b/JavaContext.st	Mon May 06 14:21:57 1996 +0000
@@ -125,12 +125,40 @@
 !JavaContext methodsFor:'printing & storing'!
 
 printString
-    |mS recCls|
+    |clsName nm mS recCls rec recClsName rnm|
+
+    clsName := class name.
+    (Smalltalk includes:(clsName asSymbol)) ifTrue:[
+        nm := 'JAVA-' , clsName
+    ] ifFalse:[
+        (class fullName startsWith:'java/lang/') ifTrue:[
+            nm := clsName
+        ] ifFalse:[
+            nm := class fullName
+        ].
+    ].
+    mS := nm , '::' , method signatureName.
+
+    rec := self receiver.
+    recCls := rec class.
 
-    mS := 'JAVA-' , class name , '::' , method signatureName.
+    (rec isKindOf:JavaObject) ifFalse:[
+        rnm := '[' , recCls name , ']'
+    ] ifTrue:[
+        recClsName := recCls name.
+        (Smalltalk includes:(recClsName asSymbol)) ifTrue:[
+            rnm := 'JAVA-' , recClsName
+        ] ifFalse:[
+            (recCls fullName startsWith:'java/lang/') ifTrue:[
+                rnm := recClsName
+            ] ifFalse:[
+                rnm := recCls fullName
+            ].
+        ].
+    ].
 
-    (recCls := self receiver class) ~~ class ifTrue:[
-        ^ recCls name , '>>' , mS
+    (rnm ~= nm) ifTrue:[
+        ^ rnm , '>>' , mS
     ].
 
     ^ mS
@@ -142,5 +170,5 @@
 !JavaContext class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaContext.st,v 1.4 1996/05/03 18:54:53 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaContext.st,v 1.5 1996/05/06 14:21:38 cg Exp $'
 ! !