454
|
1 |
"
|
2151
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
454
|
3 |
|
|
4 |
This software is furnished under a license and may be used
|
|
5 |
only in accordance with the terms of that license and with the
|
|
6 |
inclusion of the above copyright notice. This software may not
|
|
7 |
be provided or otherwise made available to, or used by, any
|
|
8 |
other person. No title to or ownership of the software is
|
|
9 |
hereby transferred.
|
2151
|
10 |
"
|
713
|
11 |
"{ Package: 'stx:libjava' }"
|
|
12 |
|
1
|
13 |
Object subclass:#JavaUnresolvedConstant
|
90
|
14 |
instanceVariableNames:'nextUnresolved prevUnresolved constantPool constantPoolIndex'
|
|
15 |
classVariableNames:'PatchLists'
|
1
|
16 |
poolDictionaries:''
|
713
|
17 |
category:'Languages-Java-Reader-Support'
|
1
|
18 |
!
|
|
19 |
|
454
|
20 |
!JavaUnresolvedConstant class methodsFor:'documentation'!
|
|
21 |
|
|
22 |
copyright
|
|
23 |
"
|
2151
|
24 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
454
|
25 |
|
|
26 |
This software is furnished under a license and may be used
|
|
27 |
only in accordance with the terms of that license and with the
|
|
28 |
inclusion of the above copyright notice. This software may not
|
|
29 |
be provided or otherwise made available to, or used by, any
|
|
30 |
other person. No title to or ownership of the software is
|
|
31 |
hereby transferred.
|
2151
|
32 |
|
|
33 |
"
|
454
|
34 |
! !
|
1
|
35 |
|
135
|
36 |
!JavaUnresolvedConstant class methodsFor:'instance creation'!
|
1
|
37 |
|
90
|
38 |
pool:aPool poolIndex:index
|
|
39 |
^ self new
|
|
40 |
pool:aPool poolIndex:index
|
1
|
41 |
|
|
42 |
|
|
43 |
! !
|
|
44 |
|
135
|
45 |
!JavaUnresolvedConstant class methodsFor:'queries'!
|
90
|
46 |
|
|
47 |
countUnresolved
|
|
48 |
|u cnt|
|
|
49 |
|
|
50 |
cnt := 0.
|
|
51 |
PatchLists do:[:patchList |
|
|
52 |
u := patchList.
|
|
53 |
[u notNil] whileTrue:[
|
|
54 |
cnt := cnt + 1.
|
|
55 |
u := u nextUnresolved
|
|
56 |
]
|
|
57 |
].
|
|
58 |
^ cnt
|
|
59 |
|
|
60 |
"
|
|
61 |
self countUnresolved
|
|
62 |
"
|
|
63 |
! !
|
|
64 |
|
135
|
65 |
!JavaUnresolvedConstant class methodsFor:'resolving'!
|
1
|
66 |
|
90
|
67 |
flushPatchLists
|
|
68 |
PatchLists := nil
|
93
|
69 |
!
|
90
|
70 |
|
399
|
71 |
patchLists
|
|
72 |
"return a collection of patchInfos for unresolved names"
|
|
73 |
|
|
74 |
^ PatchLists ? #()
|
|
75 |
|
|
76 |
"Created: / 20.10.1998 / 17:40:19 / cg"
|
|
77 |
!
|
|
78 |
|
90
|
79 |
resolveFor:aJavaClass
|
|
80 |
"a JAVA class has been loaded - resolve what can be"
|
|
81 |
|
|
82 |
|patchList unresolved nameSymbol|
|
|
83 |
|
|
84 |
"/ 'resolving: ' print. aJavaClass fullName printCR.
|
|
85 |
|
|
86 |
PatchLists isNil ifTrue:[^ self].
|
|
87 |
|
|
88 |
nameSymbol := aJavaClass fullName asSymbol.
|
|
89 |
patchList := PatchLists at:nameSymbol ifAbsent:nil.
|
|
90 |
patchList notNil ifTrue:[
|
|
91 |
PatchLists removeKey:nameSymbol.
|
|
92 |
|
|
93 |
[patchList notNil] whileTrue:[
|
|
94 |
unresolved := patchList.
|
|
95 |
patchList := unresolved nextUnresolved.
|
|
96 |
|
|
97 |
unresolved prevUnresolved:nil.
|
|
98 |
unresolved nextUnresolved:nil.
|
|
99 |
unresolved preResolve.
|
|
100 |
]
|
|
101 |
].
|
|
102 |
|
|
103 |
!
|
|
104 |
|
|
105 |
unresolvedClassNames
|
|
106 |
"return a collection of unresolved class names"
|
|
107 |
|
230
|
108 |
|l|
|
|
109 |
|
90
|
110 |
PatchLists isNil ifTrue:[^ #()].
|
230
|
111 |
|
|
112 |
"/ kludge - ignore those primitive classes ...
|
|
113 |
l := PatchLists keys
|
|
114 |
select:[:clsName |
|
|
115 |
(clsName == #char
|
|
116 |
or:[clsName == #float
|
|
117 |
or:[clsName == #double
|
|
118 |
or:[clsName == #'unsigned short'
|
|
119 |
or:[clsName == #long
|
|
120 |
or:[clsName == #boolean]]]]]) not
|
|
121 |
].
|
|
122 |
^ l
|
90
|
123 |
|
|
124 |
"
|
|
125 |
self unresolvedClassNames
|
|
126 |
"
|
230
|
127 |
|
|
128 |
"Modified: 17.8.1997 / 20:06:46 / cg"
|
90
|
129 |
! !
|
|
130 |
|
1
|
131 |
!JavaUnresolvedConstant methodsFor:'accessing'!
|
|
132 |
|
90
|
133 |
constantPool
|
|
134 |
^ constantPool
|
|
135 |
|
|
136 |
"Created: 15.4.1996 / 15:59:45 / cg"
|
|
137 |
!
|
|
138 |
|
168
|
139 |
constantPool:aPool
|
|
140 |
constantPool := aPool
|
|
141 |
|
|
142 |
"Created: 7.4.1997 / 16:13:02 / cg"
|
|
143 |
!
|
|
144 |
|
90
|
145 |
constantPoolIndex
|
|
146 |
^ constantPoolIndex
|
1
|
147 |
|
|
148 |
"Created: 15.4.1996 / 15:59:45 / cg"
|
90
|
149 |
!
|
|
150 |
|
|
151 |
nextUnresolved
|
|
152 |
^ nextUnresolved
|
|
153 |
!
|
|
154 |
|
|
155 |
nextUnresolved:anUnresolvedConstant
|
|
156 |
nextUnresolved := anUnresolvedConstant
|
|
157 |
!
|
|
158 |
|
|
159 |
pool:aPool poolIndex:i
|
|
160 |
constantPool := aPool.
|
|
161 |
constantPoolIndex := i
|
|
162 |
|
|
163 |
"Created: 15.4.1996 / 15:59:45 / cg"
|
|
164 |
!
|
|
165 |
|
|
166 |
prevUnresolved:anUnresolvedConstant
|
|
167 |
prevUnresolved := anUnresolvedConstant
|
1
|
168 |
! !
|
|
169 |
|
83
|
170 |
!JavaUnresolvedConstant methodsFor:'printing & storing'!
|
|
171 |
|
|
172 |
displayString
|
90
|
173 |
^ (self class name) , '( idx= ' , constantPoolIndex printString , ')'
|
|
174 |
|
|
175 |
|
|
176 |
! !
|
|
177 |
|
|
178 |
!JavaUnresolvedConstant methodsFor:'queries'!
|
|
179 |
|
628
|
180 |
isJavaMethodRef
|
|
181 |
^ false
|
|
182 |
|
|
183 |
"Created: / 14.11.1999 / 15:51:33 / cg"
|
|
184 |
!
|
|
185 |
|
90
|
186 |
isUnresolved
|
|
187 |
^ true
|
399
|
188 |
!
|
|
189 |
|
|
190 |
isUnresolvedClass
|
|
191 |
^ false
|
|
192 |
|
|
193 |
"Created: / 20.10.1998 / 17:43:27 / cg"
|
|
194 |
!
|
|
195 |
|
|
196 |
isUnresolvedMethod
|
|
197 |
^ false
|
|
198 |
|
|
199 |
"Created: / 20.10.1998 / 17:43:07 / cg"
|
90
|
200 |
! !
|
|
201 |
|
|
202 |
!JavaUnresolvedConstant methodsFor:'resolving'!
|
|
203 |
|
|
204 |
preResolve
|
|
205 |
self subclassResponsibility.
|
|
206 |
^ self
|
|
207 |
|
|
208 |
|
|
209 |
!
|
83
|
210 |
|
90
|
211 |
rememberForResolveWith:aFullClassName
|
|
212 |
|patchList nameSymbol|
|
|
213 |
|
|
214 |
prevUnresolved notNil ifTrue:[^ self].
|
|
215 |
|
|
216 |
PatchLists isNil ifTrue:[
|
|
217 |
PatchLists := IdentityDictionary new.
|
|
218 |
].
|
|
219 |
|
|
220 |
nameSymbol := aFullClassName asSymbol.
|
|
221 |
patchList := PatchLists at:nameSymbol ifAbsent:nil.
|
|
222 |
patchList isNil ifTrue:[
|
|
223 |
"/ ('first patch for: ' , aFullClassName) printCR.
|
|
224 |
] ifFalse:[
|
|
225 |
patchList prevUnresolved:self.
|
|
226 |
nextUnresolved := patchList.
|
|
227 |
].
|
|
228 |
PatchLists at:nameSymbol put:self.
|
|
229 |
prevUnresolved := #startOfList.
|
83
|
230 |
|
|
231 |
! !
|
|
232 |
|
206
|
233 |
!JavaUnresolvedConstant methodsFor:'special'!
|
|
234 |
|
|
235 |
updateClassRefsFrom:oldClass to:newClass
|
|
236 |
|
|
237 |
"Created: 7.8.1997 / 18:21:19 / cg"
|
|
238 |
! !
|
|
239 |
|
135
|
240 |
!JavaUnresolvedConstant class methodsFor:'documentation'!
|
1
|
241 |
|
|
242 |
version
|
2212
|
243 |
^ '$Header: /cvs/stx/stx/libjava/JavaUnresolvedConstant.st,v 1.14 2011-11-24 11:20:00 cg Exp $'
|
|
244 |
!
|
|
245 |
|
|
246 |
version_CVS
|
|
247 |
^ '$Header: /cvs/stx/stx/libjava/JavaUnresolvedConstant.st,v 1.14 2011-11-24 11:20:00 cg Exp $'
|
2151
|
248 |
!
|
|
249 |
|
|
250 |
version_SVN
|
2212
|
251 |
^ '§Id: JavaUnresolvedConstant.st,v 1.13 2011/08/18 18:42:48 vrany Exp §'
|
2108
|
252 |
! !
|