JavaUnresolvedMethodrefConstant.st
author cg
Mon, 24 Mar 1997 13:20:16 +0000
changeset 163 43e2f021c562
parent 135 098936234135
child 255 2d8b3948a08a
permissions -rw-r--r--
*** empty log message ***

JavaUnresolvedRefConstant subclass:#JavaUnresolvedMethodrefConstant
	instanceVariableNames:'classIndex'
	classVariableNames:''
	poolDictionaries:''
	category:'Java-Reader-Support'
!


!JavaUnresolvedMethodrefConstant class methodsFor:'instance creation'!

pool:aPool poolIndex:idx classIndex:cIdx nameandTypeIndex:nmIdx 
    ^ self new 
        pool:aPool poolIndex:idx classIndex:cIdx nameandTypeIndex:nmIdx
! !

!JavaUnresolvedMethodrefConstant methodsFor:'accessing'!

argSignature
    |ref cls nameAndType|

    self isUnresolved ifFalse:[
        self halt
    ].
    ref := self preResolve.
    ref isUnresolved ifFalse:[
        ^ ref argSignature
    ].
    nameAndType := (constantPool at:nameandTypeIndex).
    nameAndType isUnresolved ifTrue:[
        nameAndType displayString printCR.
    ].
    ^ JavaMethod argSigArrayFromSignature:(nameAndType signature)

    "Modified: 24.3.1997 / 13:05:57 / cg"
!

javaClass
    |ref cls|

    self isUnresolved ifFalse:[
        self halt
    ].
    ref := self preResolve.
    ref isUnresolved ifFalse:[
        ^ ref javaClass
    ].
    cls := constantPool at:classIndex.
    ^ cls

    "Created: 24.3.1997 / 13:03:59 / cg"
!

method
    |ref cls nameAndType|

    self isUnresolved ifTrue:[
        ref := self preResolve.
        ref isUnresolved ifFalse:[
            ^ ref method
        ].
        (cls := constantPool at:classIndex) isUnresolved ifTrue:[
            cls displayString printCR.
        ].
        nameAndType := (constantPool at:nameandTypeIndex).
        nameAndType isUnresolved ifTrue:[
            nameAndType displayString printCR.
        ].
    ].
('unresolved mthod: ' , self displayString) printCR.
    ^ self

    "Modified: 24.3.1997 / 13:02:56 / cg"
!

name
    |ref cls nameAndType|

    self isUnresolved ifFalse:[
        self halt
    ].
    ref := self preResolve.
    ref isUnresolved ifFalse:[
        ^ ref name
    ].
    nameAndType := (constantPool at:nameandTypeIndex).
    nameAndType isUnresolved ifTrue:[
        nameAndType displayString printCR.
    ].
    ^ nameAndType name

    "Modified: 24.3.1997 / 13:05:57 / cg"
    "Created: 24.3.1997 / 13:06:58 / cg"
!

pool:aPool poolIndex:idx classIndex:cIdx nameandTypeIndex:nmIdx
    constantPool := aPool.
    constantPoolIndex := idx.
    classIndex := cIdx.
    nameandTypeIndex := nmIdx

!

returnType
    |ref cls nameAndType|

    self isUnresolved ifFalse:[
        self halt
    ].
    ref := self preResolve.
    ref isUnresolved ifFalse:[
        ^ ref returnType
    ].
    nameAndType := (constantPool at:nameandTypeIndex).
    nameAndType isUnresolved ifTrue:[
        nameAndType displayString printCR.
    ].
    ^ JavaMethod returnTypeFromSignature:(nameAndType signature).

    "Modified: 24.3.1997 / 13:05:57 / cg"
    "Created: 24.3.1997 / 13:07:45 / cg"
! !

!JavaUnresolvedMethodrefConstant methodsFor:'resolving'!

preResolve
    |nameAndType class ref|

    "/ first, resolve the nameAndType & signature ...

    class := (constantPool at:classIndex).
    class isUnresolved ifTrue:[
        class := class preResolve.
    ].
    class isUnresolved ifFalse:[
        nameAndType := (constantPool at:nameandTypeIndex).
        nameAndType isUnresolved ifTrue:[
            nameAndType := nameAndType preResolve.
        ].
        nameAndType isUnresolved ifFalse:[
            "/ ok, got them

            ref := JavaMethodref class:class nameandType:nameAndType.
            constantPool at:constantPoolIndex put:ref.
            ^ ref
        ]
    ].

    self rememberForResolveWith:(class fullName).
    ^ self

! !

!JavaUnresolvedMethodrefConstant class methodsFor:'documentation'!

version
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaUnresolvedMethodrefConstant.st,v 1.6 1997/03/24 13:20:06 cg Exp $'
! !