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