--- a/JavaUnresolvedConstant.st Fri Jun 28 21:39:41 1996 +0000
+++ b/JavaUnresolvedConstant.st Fri Jun 28 21:39:53 1996 +0000
@@ -1,6 +1,6 @@
Object subclass:#JavaUnresolvedConstant
- instanceVariableNames:'index'
- classVariableNames:''
+ instanceVariableNames:'nextUnresolved prevUnresolved constantPool constantPoolIndex'
+ classVariableNames:'PatchLists'
poolDictionaries:''
category:'Java-Reader-Support'
!
@@ -8,14 +8,41 @@
!JavaUnresolvedConstant class methodsFor:'instance creation'!
-index:index
- ^ self new index:index
+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
+! !
+
+!JavaUnresolvedConstant class ignoredMethodsFor:'resolving'!
+
resolve:aPossiblyUnresolvedConstant from:aConstantTable
(aPossiblyUnresolvedConstant isKindOf:JavaUnresolvedConstant) ifTrue:[
^ aPossiblyUnresolvedConstant resolveFrom:aConstantTable
@@ -24,24 +51,125 @@
! !
+!JavaUnresolvedConstant class methodsFor:'resolving'!
+
+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"
+
+ PatchLists isNil ifTrue:[^ #()].
+ ^ PatchLists keys
+
+ "
+ self unresolvedClassNames
+ "
+! !
+
!JavaUnresolvedConstant methodsFor:'accessing'!
-index:i
- index := i
+constantPool
+ ^ constantPool
+
+ "Created: 15.4.1996 / 15:59:45 / 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
- ^ 'Unresolved( idx= ' , index printString , ')'
+ ^ (self class name) , '( idx= ' , constantPoolIndex printString , ')'
+
+
+! !
+
+!JavaUnresolvedConstant methodsFor:'queries'!
+
+isUnresolved
+ ^ true
+! !
+
+!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 class methodsFor:'documentation'!
version
- ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaUnresolvedConstant.st,v 1.2 1996/06/27 14:25:11 cg Exp $'
+ ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaUnresolvedConstant.st,v 1.3 1996/06/28 21:38:26 cg Exp $'
! !