added: #originalMethodIfWrapped
authorClaus Gittinger <cg@exept.de>
Fri, 19 Aug 2011 15:49:39 +0200
changeset 2158 cf16fc148fb8
parent 2157 a0c2ac13f6c6
child 2159 bab924a452d9
added: #originalMethodIfWrapped
JavaMethod.st
--- a/JavaMethod.st	Fri Aug 19 15:11:30 2011 +0200
+++ b/JavaMethod.st	Fri Aug 19 15:49:39 2011 +0200
@@ -42,15 +42,15 @@
 "{ Package: 'stx:libjava' }"
 
 CompiledCode variableSubclass:#JavaMethod
-	instanceVariableNames:'accessFlags selector javaClass descriptor signature lookupObject
-		lineNumberTable localVariableTable sourceLineNumber annotations'
-	classVariableNames:'AbstractMethodInvokationSignal SignatureTypeCodes
-		ForceByteCodeDisplay UnresolvedClassSignal A_PUBLIC A_PRIVATE
-		A_PROTECTED A_STATIC A_FINAL A_SYNCHRONIZED A_ABSTRACT A_NATIVE
-		A_BREAKPOINT R_VOID R_LONG R_DOUBLE A_HASHANDLER A_BRIDGE
-		A_VARARGS A_STRICT A_SYNTHETIC'
-	poolDictionaries:''
-	category:'Languages-Java-Classes'
+        instanceVariableNames:'accessFlags selector javaClass descriptor signature lookupObject
+                lineNumberTable localVariableTable sourceLineNumber annotations'
+        classVariableNames:'AbstractMethodInvokationSignal SignatureTypeCodes
+                ForceByteCodeDisplay UnresolvedClassSignal A_PUBLIC A_PRIVATE
+                A_PROTECTED A_STATIC A_FINAL A_SYNCHRONIZED A_ABSTRACT A_NATIVE
+                A_BREAKPOINT R_VOID R_LONG R_DOUBLE A_HASHANDLER A_BRIDGE
+                A_VARARGS A_STRICT A_SYNTHETIC'
+        poolDictionaries:''
+        category:'Languages-Java-Classes'
 !
 
 !JavaMethod class methodsFor:'documentation'!
@@ -307,8 +307,8 @@
 "/        s peek == Character space ifTrue:[
 "/            s next
 "/        ] ifFalse:[
-	    argSpec := self fieldTypeFromStream:s in:nil.
-	    spec := spec copyWith:argSpec.
+            argSpec := self fieldTypeFromStream:s in:nil.
+            spec := spec copyWith:argSpec.
 "/        ]
     ].
     ^ spec
@@ -375,11 +375,11 @@
 "/        s peek == Character space ifTrue:[
 "/            s next
 "/        ] ifFalse:[
-	    argSpec := self fieldTypeFromStream:s in:aPackage.
-	    spec size ~~ 0 ifTrue:[
-		spec := spec , ' '
-	    ].
-	    spec := spec , argSpec.
+            argSpec := self fieldTypeFromStream:s in:aPackage.
+            spec size ~~ 0 ifTrue:[
+                spec := spec , ' '
+            ].
+            spec := spec , argSpec.
 "/        ]
     ].
     ^ spec
@@ -403,21 +403,21 @@
     argNr := 1.
     spec := ''.
     [s atEnd or:[s peek == $)]] whileFalse:[
-	argSpec := self fieldTypeFromStream:s in:aPackage.
-
-	(argNames notNil
-	and:[argNames size >= argNr
-	and:[(nm := argNames at:argNr) notNil]]) ifFalse:[
-	    nm := 'arg' , argNr printString.
-	].
-	argSpec := argSpec , ' ' , nm.
-
-	spec size ~~ 0 ifTrue:[
-	    spec := spec , ', '
-	].
-	spec := spec , argSpec.
-
-	argNr := argNr + 1.
+        argSpec := self fieldTypeFromStream:s in:aPackage.
+
+        (argNames notNil
+        and:[argNames size >= argNr
+        and:[(nm := argNames at:argNr) notNil]]) ifFalse:[
+            nm := 'arg' , argNr printString.
+        ].
+        argSpec := argSpec , ' ' , nm.
+
+        spec size ~~ 0 ifTrue:[
+            spec := spec , ', '
+        ].
+        spec := spec , argSpec.
+
+        argNr := argNr + 1.
     ].
     ^ spec
 
@@ -515,19 +515,19 @@
 
     n := 0.
     [s atEnd or:[s peek == $)]] whileFalse:[
-	t := self fieldTypeFromStream:s in:nil.
-	"/
-	"/ some args count as 2
-	"/
-	t == #long ifTrue:[
-	    n := n + 2.
-	] ifFalse:[
-	    t == #double ifTrue:[
-		n := n + 2
-	    ] ifFalse:[
-		n := n + 1.
-	    ]
-	]
+        t := self fieldTypeFromStream:s in:nil.
+        "/
+        "/ some args count as 2
+        "/
+        t == #long ifTrue:[
+            n := n + 2.
+        ] ifFalse:[
+            t == #double ifTrue:[
+                n := n + 2
+            ] ifFalse:[
+                n := n + 1.
+            ]
+        ]
     ].
     ^ n
 
@@ -565,12 +565,12 @@
 
     s := aSignature readStream.
     (c := s peek) ~~ $( ifTrue:[
-	c == $' ifTrue:[
-	   [s peek ~= $'] whileTrue:[s next].
-	   s next.
-	   ^ (self retvalSpecFromStream:s in:aPackage)
-	].
-	^ (self retvalSpecFromStream:s in:aPackage)
+        c == $' ifTrue:[
+           [s peek ~= $'] whileTrue:[s next].
+           s next.
+           ^ (self retvalSpecFromStream:s in:aPackage)
+        ].
+        ^ (self retvalSpecFromStream:s in:aPackage)
     ].
 
     s next.
@@ -612,7 +612,7 @@
     s peek == $V ifTrue:[^ #void].
     spec := self fieldTypeFromStream:s in:aPackage.
     spec knownAsSymbol ifTrue:[
-	^ spec asSymbol
+        ^ spec asSymbol
     ].
     ^ spec
 
@@ -801,13 +801,13 @@
 
     s := aSignature readStream.
     (c := s peek) ~~ $( ifTrue:[
-	c == $' ifTrue:[
-	   s next.
-	   [s peek ~= $'] whileTrue:[s next].
-	   s next.
-	   ^ (self retvalSpecFromStream:s in:package)
-	].
-	^ (self retvalSpecFromStream:s in:package)
+        c == $' ifTrue:[
+           s next.
+           [s peek ~= $'] whileTrue:[s next].
+           s next.
+           ^ (self retvalSpecFromStream:s in:package)
+        ].
+        ^ (self retvalSpecFromStream:s in:package)
     ].
 
     s next.
@@ -1146,6 +1146,14 @@
     "Modified: / 13.1.1998 / 17:34:37 / cg"
 !
 
+originalMethodIfWrapped
+    "return the method the receiver is wrapping - none here"
+
+    ^ self
+
+    "Created: / 22-10-2010 / 11:46:07 / cg"
+!
+
 previousVersion
     ^ nil
 
@@ -1176,38 +1184,38 @@
     |cls returnType|
 
     (returnType := self returnType) isNil ifTrue:[
-	self halt.
+        self halt.
     ].
     cls := Java at:returnType.
     cls notNil ifTrue:[^ cls].
 
     returnType == #void ifTrue:[
-	^ nil
+        ^ nil
     ].
     returnType == #double ifTrue:[
-	'warning: no returnTypeClass for double' printCR.
+        'warning: no returnTypeClass for double' printCR.
 "/        self halt:'no returnTypeClass for double'.
-	^ nil
+        ^ nil
     ].
     returnType == #float ifTrue:[
-	'warning: no returnTypeClass for float' printCR.
+        'warning: no returnTypeClass for float' printCR.
 "/        self halt:'no returnTypeClass for float'.
-	^ nil
+        ^ nil
     ].
     returnType == #long ifTrue:[
-	'warning: no returnTypeClass for long' printCR.
+        'warning: no returnTypeClass for long' printCR.
 "/        self halt:'no returnTypeClass for long'.
-	^ nil
+        ^ nil
     ].
     returnType == #int ifTrue:[
-	'warning: no returnTypeClass for int' printCR.
+        'warning: no returnTypeClass for int' printCR.
 "/        self halt:'no returnTypeClass for int'.
-	^ nil
+        ^ nil
     ].
     returnType == #boolean ifTrue:[
-	'warning: no returnTypeClass for boolean' printCR.
+        'warning: no returnTypeClass for boolean' printCR.
 "/        self halt:'no returnTypeClass for boolean'.
-	^ nil
+        ^ nil
     ].
     self halt.
     ^ nil
@@ -1247,10 +1255,7 @@
 !
 
 signature
-
     ^ signature ? descriptor
-
-    "Modified (format): / 14-08-2011 / 19:37:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 source
@@ -1313,7 +1318,6 @@
 programmingLanguage
 
     ^JavaLanguage instance
-
     "Created: / 26-10-2010 / 23:42:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
@@ -1327,7 +1331,7 @@
 
 clearBreakPoint
     self hasCode ifTrue:[
-	MessageTracer unwrapMethod:self
+        MessageTracer unwrapMethod:self
     ].
     accessFlags := (accessFlags bitClear:A_BREAKPOINT).
 
@@ -1348,7 +1352,7 @@
 
 setBreakPoint
     self hasCode ifTrue:[
-	MessageTracer trapMethod:self
+        MessageTracer trapMethod:self
     ].
     accessFlags := (accessFlags bitOr:A_BREAKPOINT).
 
@@ -1639,34 +1643,34 @@
     allBytes := allWords := true.
 
     anArrayOfPCtoLineAssociations do:[:assoc |
-	assoc key > 255 ifTrue:[
-	    allBytes := false.
-	    assoc key > 16rFFFF ifTrue:[
-		allWords := false.
-	    ].
-	].
-	assoc value > 255 ifTrue:[
-	    allBytes := false.
-	    assoc value > 16rFFFF ifTrue:[
-		allWords := false
-	    ].
-	].
+        assoc key > 255 ifTrue:[
+            allBytes := false.
+            assoc key > 16rFFFF ifTrue:[
+                allWords := false.
+            ].
+        ].
+        assoc value > 255 ifTrue:[
+            allBytes := false.
+            assoc value > 16rFFFF ifTrue:[
+                allWords := false
+            ].
+        ].
     ].
     allBytes ifTrue:[
-	lineNumberTable := ByteArray new:(anArrayOfPCtoLineAssociations size * 2).
+        lineNumberTable := ByteArray new:(anArrayOfPCtoLineAssociations size * 2).
     ] ifFalse:[
-	allWords ifTrue:[
-	    lineNumberTable := WordArray new:(anArrayOfPCtoLineAssociations size * 2).
-	] ifFalse:[
-	    lineNumberTable := Array new:(anArrayOfPCtoLineAssociations size * 2).
-	]
+        allWords ifTrue:[
+            lineNumberTable := WordArray new:(anArrayOfPCtoLineAssociations size * 2).
+        ] ifFalse:[
+            lineNumberTable := Array new:(anArrayOfPCtoLineAssociations size * 2).
+        ]
     ].
 
     idx := 1.
     anArrayOfPCtoLineAssociations do:[:assoc |
-	lineNumberTable at:idx   put:assoc key.
-	lineNumberTable at:idx+1 put:assoc value.
-	idx := idx + 2.
+        lineNumberTable at:idx   put:assoc key.
+        lineNumberTable at:idx+1 put:assoc value.
+        idx := idx + 2.
     ].
 
     "Created: 16.4.1996 / 12:34:04 / cg"
@@ -1826,8 +1830,8 @@
 
 updateClassRefsFrom:oldClass to:newClass
     javaClass == oldClass ifTrue:[
-	"/ invalidate
-	byteCode := nil.
+        "/ invalidate
+        byteCode := nil.
     ]
 
     "Created: / 6.1.1998 / 18:19:48 / cg"
@@ -1910,7 +1914,7 @@
 
     myName := self name.
     myName = '<init>' ifTrue:[
-	myName := javaClass name
+        myName := javaClass name
     ].
     ^ self class specFromSignature:descriptor withName:myName argNames:argNames in:nil
 
@@ -1925,7 +1929,7 @@
 
     myName := self name.
     myName = '<init>' ifTrue:[
-	myName := javaClass name
+        myName := javaClass name
     ].
     ^ self class specFromSignature:descriptor withName:myName argNames:argNames in:package
 
@@ -2098,42 +2102,42 @@
 
     ForceByteCodeDisplay == true ifFalse:[
 
-	lineNumberTable notNil ifTrue:[
-	    classSource := javaClass source.
-	    classSource notNil ifTrue:[
-		lineNumberTable pairWiseDo:[:lPc :lNr |
-		    lPc >= pc ifTrue:[
-			lPc == pc ifTrue:[^ lNr].
-			last isNil ifTrue:[^ lNr].
-			^ last.
-		    ].
-		    last := lNr.
-		].
-		last notNil ifTrue:[        
-		    ^ last
-		].
-		^ lineNumberTable at:2
-	    ].
-	].
+        lineNumberTable notNil ifTrue:[
+            classSource := javaClass source.
+            classSource notNil ifTrue:[
+                lineNumberTable pairWiseDo:[:lPc :lNr |
+                    lPc >= pc ifTrue:[
+                        lPc == pc ifTrue:[^ lNr].
+                        last isNil ifTrue:[^ lNr].
+                        ^ last.
+                    ].
+                    last := lNr.
+                ].
+                last notNil ifTrue:[        
+                    ^ last
+                ].
+                ^ lineNumberTable at:2
+            ].
+        ].
     ].
 
     "/ decompile and look which line the pc falls into
 
     ForceByteCodeDisplay == true ifTrue:[
-	text := self decompiledBytecode asCollectionOfLines.
+        text := self decompiledBytecode asCollectionOfLines.
     ] ifFalse:[
-	text := self decompiledSource asCollectionOfLines.
+        text := self decompiledSource asCollectionOfLines.
     ].
 
     text keysAndValuesDo:[:lineNr :line |
-	|nr|
-
-	(line startsWith:'    ') ifFalse:[
-	    nr := Integer readFrom:line onError:0.
-	    nr >= pc ifTrue:[
-		^ lineNr
-	    ]
-	]
+        |nr|
+
+        (line startsWith:'    ') ifFalse:[
+            nr := Integer readFrom:line onError:0.
+            nr >= pc ifTrue:[
+                ^ lineNr
+            ]
+        ]
     ].
     ^ num
 
@@ -2186,18 +2190,18 @@
     |last|
 
     lineNumberTable notNil ifTrue:[
-	lineNumberTable pairWiseDo:[:lPc :lNr |
-	    lPc >= pc ifTrue:[
-		lPc == pc ifTrue:[^ lNr].
-		last isNil ifTrue:[^ lNr].
-		^ last.
-	    ].
-	    last := lNr.
-	].
-	last notNil ifTrue:[        
-	    ^ last
-	].
-	^ lineNumberTable at:2
+        lineNumberTable pairWiseDo:[:lPc :lNr |
+            lPc >= pc ifTrue:[
+                lPc == pc ifTrue:[^ lNr].
+                last isNil ifTrue:[^ lNr].
+                ^ last.
+            ].
+            last := lNr.
+        ].
+        last notNil ifTrue:[        
+            ^ last
+        ].
+        ^ lineNumberTable at:2
     ].
     ^ nil
 
@@ -2378,15 +2382,15 @@
 !JavaMethod class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.107 2011-08-18 18:42:48 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.108 2011-08-19 13:49:39 cg Exp $'
 !
 
 version_CVS
-    ^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethod.st,v 1.106 2009/10/09 14:04:17 cg Exp §'
+    ^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.108 2011-08-19 13:49:39 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: JavaMethod.st,v 1.107 2011-08-18 18:42:48 vrany Exp $'
+    ^ '§Id: JavaMethod.st,v 1.107 2011/08/18 18:42:48 vrany Exp §'
 ! !
 
 JavaMethod initialize!