'From Smalltalk/X, Version:3.3.1 on 8-jan-1998 at 9:38:10 pm' !
JavaRef subclass:#JavaMethodref
instanceVariableNames:'method sel lastClass lastMethod'
classVariableNames:''
poolDictionaries:''
category:'Java-Reader-Support'
!
!JavaMethodref class methodsFor:'flushing'!
flushCaches
self allInstancesDo:[:ref |
ref flush
].
"
JavaMethodref flushCaches
"
"Modified: 20.3.1997 / 00:10:24 / cg"
! !
!JavaMethodref methodsFor:'accessing'!
argSignature
^ JavaMethod argSigArrayFromSignature:(self signature)
"Created: 24.3.1997 / 12:22:50 / cg"
!
lastClass
"return lastClass"
^ lastClass!
lastClass:something
"set lastClass"
lastClass := something.!
lastMethod
"return lastMethod"
^ lastMethod!
lastMethod:something
"set lastMethod"
lastMethod := something.!
lastMethod:someMethod lastClass:someClass
"set lastMethod & lastClass"
lastMethod := someMethod.
lastClass := someClass.
"Created: 4.8.1997 / 18:21:11 / cg"
!
name
^ nameandType name.
!
returnType
^ JavaMethod returnTypeFromSignature:(self signature) in:nil.
"Modified: / 8.1.1998 / 19:07:41 / cg"
!
selector
sel isNil ifTrue:[
sel := (nameandType name , nameandType signature) asSymbol.
].
^ sel
!
signature
^ nameandType signature.
! !
!JavaMethodref methodsFor:'printing & storing'!
displayString
^ 'JavaMethodRef (' , class displayString , ' '
, '''' , nameandType name , '''' , nameandType signature , ')'
! !
!JavaMethodref methodsFor:'resolving'!
flush
method := nil.
lastClass := nil.
lastMethod := nil
"Created: 20.3.1997 / 00:10:01 / cg"
!
method
|nm sig mthd cls|
method notNil ifTrue:[^ method].
cls := class javaClass.
cls ~~ class ifTrue:[
class := cls.
].
"/ (class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
"/ cls := class resolve.
"/ cls notNil ifTrue:[
"/ class := cls
"/ ]
"/ ].
"/ (class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
"/ self halt:'unresolved class'.
"/ ].
sel isNil ifTrue:[
nm := nameandType name asSymbol.
sig := nameandType signature.
sel := (nm , sig) asSymbol.
].
"/ 'search in: ' print. class fullName print. ' for ' print. nm print. ' sig: ' print. sig printNL.
mthd := class compiledMethodAt:sel.
mthd isNil ifTrue:[
"/ self halt:'no method found for: ' , self displayString.
^ nil.
"/ old: ^ self.
].
mthd checkForNOOPMethod.
^ mthd
"Modified: 31.7.1997 / 22:16:24 / cg"
!
methodFor:aClass
|nm sig mthd cls|
cls := aClass.
cls == Array ifTrue:[
cls := Java classNamed:'java.lang.Object'.
] ifFalse:[
cls == UndefinedObject ifTrue:[
cls := Java classNamed:'java.lang.Object'.
] ifFalse:[
cls isBehavior ifTrue:[
cls isMeta ifTrue:[
cls := cls soleInstance.
].
(cls isKindOf:JavaClass) ifFalse:[
"/ self halt:'not a javaClass'.
^ nil
]
].
"/ cls := cls javaClass.
].
].
cls isUnresolved ifTrue:[
self halt:'unresolved class'.
].
sel isNil ifTrue:[
nm := nameandType name asSymbol.
sig := nameandType signature.
sel := (nm , sig) asSymbol.
].
[cls notNil] whileTrue:[
mthd := cls compiledMethodAt:sel.
mthd notNil ifTrue:[
lastClass := aClass.
lastMethod := mthd.
^ mthd
].
cls := cls superclass
].
^ nil
"Modified: 26.3.1997 / 13:32:39 / cg"
! !
!JavaMethodref methodsFor:'special'!
updateClassRefsFrom:oldClass to:newClass
lastClass := nil.
lastMethod := nil.
super updateClassRefsFrom:oldClass to:newClass
"Created: 7.8.1997 / 15:00:46 / cg"
! !
!JavaMethodref class methodsFor:'documentation'!
version
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethodref.st,v 1.30 1998/01/12 14:24:36 cg Exp $'
! !