JavaUnresolvedClassConstant.st
author cg
Tue, 25 Jun 1996 08:20:31 +0000
changeset 67 a72c949d86dd
parent 54 f37bcefb7091
child 70 ffdc3ff494c1
permissions -rw-r--r--
*** empty log message ***

JavaUnresolvedConstant subclass:#JavaUnresolvedClassConstant
	instanceVariableNames:'fullName pool poolIndex'
	classVariableNames:''
	poolDictionaries:''
	category:'Java-Reader-Support'
!


!JavaUnresolvedClassConstant  class methodsFor:'instance creation'!

fullName:nm
    ^ self new fullName:nm
!

nameIndex:index pool:aConstantPool slotIndex:slotIndex
    ^ self new index:index pool:aConstantPool slotIndex:slotIndex
! !

!JavaUnresolvedClassConstant methodsFor:'accessing'!

className
    |s nm|

    (fullName startsWith:$[) ifTrue:[
        "/ a ref for newarray or new or checkCast

        s := fullName readStream.
        s next.
        nm := JavaMethod retvalSpecFromStream:s.
        ^ nm
    ].
    ^ fullName

!

fullName
    ^ fullName

!

fullName:nm
    fullName := nm

!

index:index pool:aConstantPool slotIndex:slotIndex
    super index:index.
    pool := aConstantPool.
    poolIndex := slotIndex.

! !

!JavaUnresolvedClassConstant methodsFor:'printing & storing'!

displayString
    fullName isNil ifTrue:[
        ^ 'Unresolved(** nil **)'
    ].
    ^ 'Unresolved(' , (fullName copy replaceAll:$/ by:$.) , ')'
! !

!JavaUnresolvedClassConstant methodsFor:'resolving'!

resolve
    |cls|

    cls := Java classNamed:fullName.
    cls notNil ifTrue:[
        pool notNil ifTrue:[
            pool at:poolIndex put:cls
        ].
    ] ifFalse:[
        Java rememberUnresolved:self.
    ].
    ^ cls

    "Created: 15.4.1996 / 15:51:42 / cg"
    "Modified: 15.4.1996 / 16:26:05 / cg"
!

resolveFrom:aConstantTable
    |cls nm s ref|

    fullName := self class resolve:(aConstantTable at:index) from:aConstantTable.
'resolve: ' print. fullName printCR.

    cls := Java classNamed:fullName.
    cls notNil ifTrue:[
        ^ cls
    ].

    (fullName startsWith:$[) ifTrue:[
        "/ a ref for newarray or new

        s := fullName readStream.
        s next.
        nm := JavaMethod retvalSpecFromStream:s.
        cls := Java classNamed:nm.
        cls notNil ifTrue:[
            ref := JavaClassPointerRef class:cls nameandType:fullName.
            ^ ref
        ].
    ].

    Java rememberUnresolved:self.
    ^ self
"/    ^ JavaClass fullName:fullName

    "Created: 15.4.1996 / 15:51:42 / cg"
    "Modified: 15.4.1996 / 16:26:05 / cg"
! !

!JavaUnresolvedClassConstant  class methodsFor:'documentation'!

version
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaUnresolvedClassConstant.st,v 1.11 1996/06/25 08:19:35 cg Exp $'
! !