JavaMethod.st
branchdevelopment
changeset 2704 0f7f5f5c67c7
parent 2698 c243b2455f71
child 2708 648286432b9a
--- a/JavaMethod.st	Mon Sep 02 09:59:56 2013 +0100
+++ b/JavaMethod.st	Mon Sep 02 10:08:10 2013 +0100
@@ -2027,10 +2027,16 @@
 "/        ^ (LabelAndIcon '!! ' , self signatureName
 "/    ].
 
+    self name = #'<clinit>' ifTrue:[
+        ^ 'static {}'
+    ].
+
     self name = #'<init>' ifTrue:[
         ^ self class specTextFromSignature:descriptor in:javaClass package withName:(javaClass lastName).
     ].
     ^ self class specTextFromSignature:descriptor in:javaClass package withName:(self name)
+
+    "Modified: / 31-08-2013 / 23:28:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 shortDisplayString
@@ -2381,37 +2387,9 @@
 
 messagesSent
     "return a collection of messages sent by this method"
-
-    |walker selectors|
-
-    "/ sigh - must extract all accessed literals ...
-    "/ must deparse the byteCode in order to do this.
-
-    selectors := IdentitySet new.
-    walker := JavaByteCodeEnumerator new.
-    walker 
-        literalAction:
-            [:pc :slotIndex :const |
-                |mSel|
-
-                (const isNumber 
-                or:[const isString
-                or:[const isNil]]) ifFalse:[
-                    const isJavaMethod ifTrue:[
-                        mSel := const selector.
-                    ] ifFalse:[
-                        const isJavaMethodRef ifTrue:[
-                            mSel := const selector "/ signature.
-                        ]
-                    ].
-                ].
-                mSel notNil ifTrue:[
-                    "/ Transcript showCR:mSel.
-                    selectors add:mSel
-                ].
-            ].
-    walker decompile:self to:nil.
-    ^ selectors
+    ^ self analyzer messagesSent
+
+    "Modified: / 31-08-2013 / 10:43:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 overrides: anotherMethod
@@ -2541,58 +2519,11 @@
     "return true, if this method contains a message-send
      with aSelectorSymbol as selector."
 
-    |walker any|
-
-    "/ quick check, if constantPool includes a methodRef for this
-    "/ selector.
-
-    any := false.
-    self javaClass constantPool do:[:const |
-        (const isNumber 
-        or:[const isString
-        or:[const isNil]]) ifFalse:[
-            const isJavaMethod ifTrue:[
-                any := any or:[const selector = aSelectorSymbol].
-            ] ifFalse:[
-                const isJavaMethodRef ifTrue:[
-                    any := any or:[const signature = aSelectorSymbol].
-                ]
-            ].
-        ].
-    ].
-    any ifFalse:[^ false].
-
-    "/ sigh - must extract all accessed literals ...
-    "/ must deparse the byteCode in order to do this.
-
-    walker := JavaByteCodeEnumerator new.
-    walker 
-        literalAction:
-            [:pc :slotIndex :const |
-                |mSel|
-
-                (const isNumber 
-                or:[const isString
-                or:[const isNil]]) ifFalse:[
-                    const isJavaMethod ifTrue:[
-                        mSel := const selector.
-                    ] ifFalse:[
-                        const isJavaMethodRef ifTrue:[
-                            mSel := const signature.
-                        ]
-                    ].
-                ].
-                mSel notNil ifTrue:[
-                    "/ Transcript showCR:mSel.
-                    mSel = aSelectorSymbol ifTrue:[
-                        ^ true
-                    ]
-                ].
-            ].
-    walker decompile:self to:nil.
-
-    "Created: / 9.11.1999 / 15:38:14 / cg"
-    "Modified: / 9.11.1999 / 17:06:03 / cg"
+     ^ self analyzer sends: aSelectorSymbol
+
+    "Created: / 09-11-1999 / 15:38:14 / cg"
+    "Modified: / 09-11-1999 / 17:06:03 / cg"
+    "Modified: / 31-08-2013 / 11:37:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 shouldBeSkippedInDebuggersWalkBack
@@ -2625,6 +2556,12 @@
     "Modified: / 30-08-2013 / 17:07:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+messagesSentToSelf
+    ^ self analyzer messagesSentToSelf
+
+    "Created: / 31-08-2013 / 09:32:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 messagesSentToSuper
     ^ self analyzer messagesSentToSuper