JavaRef subclass:#JavaMethodref
instanceVariableNames:'method sel'
classVariableNames:''
poolDictionaries:''
category:'Java-Reader-Support'
!
!JavaMethodref methodsFor:'accessing'!
name
^ nameandType name.
!
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'!
method
|nm sig mthd|
method notNil ifTrue:[^ method].
(class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
class := class resolve
].
(class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
self halt.
].
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 notNil ifTrue:[^ mthd].
self halt:'no such method found'.
!
methodFor:aClass
|nm sig mthd cls|
cls := aClass.
cls == Array ifTrue:[
cls := Java classNamed:'java.lang.Object'.
].
(cls isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
cls := cls resolve
].
(cls isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
self halt.
].
sel isNil ifTrue:[
nm := nameandType name asSymbol.
sig := nameandType signature.
sel := (nm , sig) asSymbol.
].
[cls notNil] whileTrue:[
mthd := cls compiledMethodAt:sel.
mthd notNil ifTrue:[^ mthd].
cls := cls superclass
].
^ nil
! !
!JavaMethodref class methodsFor:'documentation'!
version
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethodref.st,v 1.10 1996/06/25 19:56:26 cg Exp $'
! !