"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague
Parts of the code written by Claus Gittinger are under following
license:
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.
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
[1] Code written at SWING Research Group contain a signature
of one of the above copright owners.
"
"{ Package: 'stx:libjava' }"
Object subclass:#JavaUnresolvedConstant
instanceVariableNames:'nextUnresolved prevUnresolved constantPool constantPoolIndex'
classVariableNames:'PatchLists'
poolDictionaries:''
category:'Languages-Java-Reader-Support'
!
!JavaUnresolvedConstant class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague
Parts of the code written by Claus Gittinger are under following
license:
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.
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the 'Software'), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
[1] Code written at SWING Research Group contain a signature
of one of the above copright owners.
"
! !
!JavaUnresolvedConstant class methodsFor:'instance creation'!
pool:aPool poolIndex:index
^ self new
pool:aPool poolIndex:index
! !
!JavaUnresolvedConstant class methodsFor:'queries'!
countUnresolved
|u cnt|
cnt := 0.
PatchLists do:[:patchList |
u := patchList.
[u notNil] whileTrue:[
cnt := cnt + 1.
u := u nextUnresolved
]
].
^ cnt
"
self countUnresolved
"
! !
!JavaUnresolvedConstant class methodsFor:'resolving'!
flushPatchLists
PatchLists := nil
!
patchLists
"return a collection of patchInfos for unresolved names"
^ PatchLists ? #()
"Created: / 20.10.1998 / 17:40:19 / cg"
!
resolveFor:aJavaClass
"a JAVA class has been loaded - resolve what can be"
|patchList unresolved nameSymbol|
"/ 'resolving: ' print. aJavaClass fullName printCR.
PatchLists isNil ifTrue:[^ self].
nameSymbol := aJavaClass fullName asSymbol.
patchList := PatchLists at:nameSymbol ifAbsent:nil.
patchList notNil ifTrue:[
PatchLists removeKey:nameSymbol.
[patchList notNil] whileTrue:[
unresolved := patchList.
patchList := unresolved nextUnresolved.
unresolved prevUnresolved:nil.
unresolved nextUnresolved:nil.
unresolved preResolve.
]
].
!
unresolvedClassNames
"return a collection of unresolved class names"
|l|
PatchLists isNil ifTrue:[^ #()].
"/ kludge - ignore those primitive classes ...
l := PatchLists keys
select:[:clsName |
(clsName == #char
or:[clsName == #float
or:[clsName == #double
or:[clsName == #'unsigned short'
or:[clsName == #long
or:[clsName == #boolean]]]]]) not
].
^ l
"
self unresolvedClassNames
"
"Modified: 17.8.1997 / 20:06:46 / cg"
! !
!JavaUnresolvedConstant methodsFor:'accessing'!
constantPool
^ constantPool
"Created: 15.4.1996 / 15:59:45 / cg"
!
constantPool:aPool
constantPool := aPool
"Created: 7.4.1997 / 16:13:02 / cg"
!
constantPoolIndex
^ constantPoolIndex
"Created: 15.4.1996 / 15:59:45 / cg"
!
nextUnresolved
^ nextUnresolved
!
nextUnresolved:anUnresolvedConstant
nextUnresolved := anUnresolvedConstant
!
pool:aPool poolIndex:i
constantPool := aPool.
constantPoolIndex := i
"Created: 15.4.1996 / 15:59:45 / cg"
!
prevUnresolved:anUnresolvedConstant
prevUnresolved := anUnresolvedConstant
! !
!JavaUnresolvedConstant methodsFor:'printing & storing'!
displayString
^ (self class name) , '( idx= ' , constantPoolIndex printString , ')'
! !
!JavaUnresolvedConstant methodsFor:'queries'!
isJavaMethodRef
^ false
"Created: / 14.11.1999 / 15:51:33 / cg"
!
isUnresolved
^ true
!
isUnresolvedClass
^ false
"Created: / 20.10.1998 / 17:43:27 / cg"
!
isUnresolvedMethod
^ false
"Created: / 20.10.1998 / 17:43:07 / cg"
! !
!JavaUnresolvedConstant methodsFor:'resolving'!
preResolve
self subclassResponsibility.
^ self
!
rememberForResolveWith:aFullClassName
|patchList nameSymbol|
prevUnresolved notNil ifTrue:[^ self].
PatchLists isNil ifTrue:[
PatchLists := IdentityDictionary new.
].
nameSymbol := aFullClassName asSymbol.
patchList := PatchLists at:nameSymbol ifAbsent:nil.
patchList isNil ifTrue:[
"/ ('first patch for: ' , aFullClassName) printCR.
] ifFalse:[
patchList prevUnresolved:self.
nextUnresolved := patchList.
].
PatchLists at:nameSymbol put:self.
prevUnresolved := #startOfList.
! !
!JavaUnresolvedConstant methodsFor:'special'!
updateClassRefsFrom:oldClass to:newClass
"Created: 7.8.1997 / 18:21:19 / cg"
! !
!JavaUnresolvedConstant class methodsFor:'documentation'!
version
^ '$Id: JavaUnresolvedConstant.st,v 1.13 2011/08/18 18:42:48 vrany Exp $'
!
version_SVN
^ '$Id: JavaUnresolvedConstant.st,v 1.13 2011/08/18 18:42:48 vrany Exp $'
! !