"
COPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
"{ Package: 'stx:libjava' }"
JavaUnresolvedRefConstant subclass:#JavaUnresolvedMethodrefConstant
instanceVariableNames:'classIndex'
classVariableNames:''
poolDictionaries:''
category:'Languages-Java-Reader-Support'
!
!JavaUnresolvedMethodrefConstant class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
! !
!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) in:nil.
"Created: / 24.3.1997 / 13:07:45 / cg"
"Modified: / 8.1.1998 / 19:07:47 / cg"
!
signature
^ self name
"Created: / 14.11.1999 / 15:52:39 / cg"
! !
!JavaUnresolvedMethodrefConstant methodsFor:'queries'!
isJavaClassRef
^ false
"Created: / 9.11.1999 / 17:18:24 / cg"
!
isJavaMethodRef
^ true
"Created: / 9.11.1999 / 15:39:59 / cg"
!
isUnresolvedMethod
^ true
"Created: / 20.10.1998 / 17:43:19 / 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
!
resolveMethod
"this is possibly invoked by the VM, when an unresolved methodRef is encountered.a
It should load&resolve the methodRef, and return the actual method,
or else return nil (if the method cannot be resolved)."
|nm sig mthd cls class|
class := (constantPool at:classIndex).
class isUnresolved ifTrue:[
class := class preResolve.
].
class isUnresolved ifTrue:[
"/ self halt:'unresolved class: ' , class name.
JavaVM throwClassNotFoundException:class name.
^ nil.
].
self halt.
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'.
].
mthd := self preResolve.
mthd == self ifTrue:[
self halt:'unresolved method'.
].
^ mthd
! !
!JavaUnresolvedMethodrefConstant class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libjava/Attic/JavaUnresolvedMethodrefConstant.st,v 1.16 2002-11-22 20:11:36 cg Exp $'
! !