JavaMethodref.st
author cg
Mon, 24 Jun 1996 15:11:09 +0000
changeset 63 74442cd26c02
parent 52 1dc41619b6f8
child 71 feb1b4907dd4
permissions -rw-r--r--
changes for new methodDict

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 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.9 1996/06/24 15:11:09 cg Exp $'
! !