author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 08 Oct 2013 10:02:41 +0100 | |
branch | development |
changeset 2811 | 8542f6311dcc |
parent 2757 | 66f842986836 |
child 2817 | 96f3e2254489 |
permissions | -rw-r--r-- |
454 | 1 |
" |
2151 | 2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
3 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
4 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
5 |
|
2151 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
7 |
SWING Research Group, Czech Technical University in Prague |
454 | 8 |
|
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. |
|
2151 | 15 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
16 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
17 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
18 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
19 |
as of 1.9.2010 |
2151 | 20 |
" |
713 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
23 |
Array variableSubclass:#JavaConstantPool |
89 | 24 |
instanceVariableNames:'owner' |
2151 | 25 |
classVariableNames:'ConstantPools' |
89 | 26 |
poolDictionaries:'' |
713 | 27 |
category:'Languages-Java-Reader-Support' |
89 | 28 |
! |
29 |
||
454 | 30 |
!JavaConstantPool class methodsFor:'documentation'! |
31 |
||
32 |
copyright |
|
33 |
" |
|
2151 | 34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
35 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
36 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
37 |
|
2151 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
39 |
SWING Research Group, Czech Technical University in Prague |
454 | 40 |
|
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. |
|
2151 | 47 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
48 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
49 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
50 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
51 |
as of 1.9.2010 |
2151 | 52 |
|
454 | 53 |
" |
2151 | 54 |
! ! |
55 |
||
56 |
!JavaConstantPool class methodsFor:'accessing'! |
|
57 |
||
58 |
allConstantPools |
|
59 |
"linked list of all constant pools in system" |
|
60 |
^ ConstantPools. |
|
61 |
||
62 |
"Created: / 08-04-2011 / 16:53:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
63 |
"Modified: / 09-04-2011 / 09:24:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
64 |
! |
|
65 |
||
66 |
allConstantPools: anOorderedCollection |
|
67 |
"linked list of all constant pools in system" |
|
68 |
||
69 |
ConstantPools := anOorderedCollection. |
|
70 |
||
71 |
"Created: / 08-04-2011 / 17:07:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
72 |
"Modified: / 09-04-2011 / 09:24:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
73 |
"Modified: / 11-04-2011 / 18:47:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
454 | 74 |
! ! |
89 | 75 |
|
243 | 76 |
!JavaConstantPool class methodsFor:'special'! |
77 |
||
2151 | 78 |
invalidateForClass: internalJavaClassName |
79 |
"Go over all constant pools and call invalidateForClass on all |
|
80 |
references. (usable when given class was unloaded etc)" |
|
81 |
ConstantPools do: [:each | each invalidateForClass: internalJavaClassName]. |
|
243 | 82 |
|
2757
66f842986836
cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
2755
diff
changeset
|
83 |
"Created: / 08-04-2011 / 16:52:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
66f842986836
cleanup multiple Java class versions handling
Marcel Hlopko <marcel.hlopko@gmail.com>
parents:
2755
diff
changeset
|
84 |
"Modified: / 02-10-2013 / 21:05:44 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
243 | 85 |
! ! |
86 |
||
89 | 87 |
!JavaConstantPool methodsFor:'accessing'! |
88 |
||
89 |
owner |
|
90 |
"return owner" |
|
91 |
||
92 |
^ owner |
|
93 |
||
94 |
"Created: 28.6.1996 / 21:12:22 / cg" |
|
95 |
! |
|
96 |
||
97 |
owner:something |
|
98 |
"set owner" |
|
99 |
||
100 |
owner := something. |
|
101 |
||
102 |
"Created: 28.6.1996 / 21:12:22 / cg" |
|
103 |
! ! |
|
104 |
||
2151 | 105 |
!JavaConstantPool methodsFor:'adding'! |
106 |
||
107 |
at: classRefIndex putClassRefWithNameAt: classNameIndex |
|
108 |
self at: classRefIndex |
|
109 |
put: (JavaClassRef2 in: self withNameAt: classNameIndex). |
|
110 |
||
111 |
"Created: / 13-05-2011 / 09:48:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
112 |
! |
|
113 |
||
114 |
at: fieldRefIndex putFieldRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
|
115 |
self at: fieldRefIndex |
|
116 |
put: (JavaFieldRef2 |
|
117 |
in: self |
|
118 |
withNameAndTypeAt: nameAndTypeIndex |
|
119 |
andClassAt: classRefIndex). |
|
120 |
||
121 |
"Created: / 13-05-2011 / 09:08:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
122 |
! |
|
123 |
||
124 |
at: interfaceMethodRefIndex putInterfaceMethodRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
|
125 |
self at: interfaceMethodRefIndex |
|
126 |
put: (JavaInterfaceMethodRef2 |
|
127 |
in: self |
|
128 |
withNameAndTypeAt: nameAndTypeIndex |
|
129 |
andClassAt: classRefIndex). |
|
130 |
||
131 |
"Created: / 13-05-2011 / 09:08:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
132 |
! |
|
133 |
||
134 |
at: methodRefIndex putMethodRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
|
135 |
self at: methodRefIndex |
|
136 |
put: (JavaMethodRef2 in: self withNameAndTypeAt: nameAndTypeIndex andClassAt:classRefIndex). |
|
137 |
||
138 |
"Created: / 13-05-2011 / 09:07:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
139 |
! |
|
140 |
||
141 |
at: nameAndTypeIndex putNameAndTypeWithNameAt: nameIndex andDescriptorAt: descriptorIndex |
|
142 |
self at: nameAndTypeIndex |
|
143 |
put: (JavaNameAndType2 in: self withNameAt: nameIndex andDescriptorAt: descriptorIndex). |
|
144 |
||
145 |
"Created: / 13-05-2011 / 09:05:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
146 |
! ! |
|
147 |
||
148 |
||
89 | 149 |
!JavaConstantPool methodsFor:'printing & storing'! |
150 |
||
151 |
displayString |
|
152 |
owner isNil ifTrue:[ |
|
153 |
^ '*** unowned ConstantPool' |
|
154 |
]. |
|
155 |
^ 'ConstantPool of ' , owner fullName |
|
156 |
||
157 |
"Created: 28.6.1996 / 21:13:41 / cg" |
|
158 |
"Modified: 28.6.1996 / 21:20:26 / cg" |
|
159 |
! ! |
|
160 |
||
171 | 161 |
!JavaConstantPool methodsFor:'queries'! |
162 |
||
163 |
refersToMethod:aJavaMethod |
|
2151 | 164 |
|
165 |
self error: 'JV@2011-07-26: Update to new resolving scheme!!'. |
|
166 |
||
171 | 167 |
self do:[:constItem | |
168 |
(constItem == aJavaMethod) ifTrue:[^ true]. |
|
2151 | 169 |
|
170 |
]. |
|
171 |
^ false |
|
172 |
||
173 |
"Created: / 29-07-1997 / 17:39:19 / cg" |
|
174 |
"Modified: / 26-07-2011 / 18:00:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
175 |
! |
|
176 |
||
177 |
refersToMethodNamed:aJavaMethodName |
|
178 |
||
179 |
self error: 'JV@2011-07-26: Update to new resolving scheme!!'. |
|
180 |
||
181 |
self do:[:constItem | |
|
182 |
(constItem isKindOf:JavaMethod) ifTrue:[ |
|
183 |
constItem name = aJavaMethodName ifTrue:[^ true]. |
|
184 |
] ifFalse:[ |
|
185 |
||
2108 | 186 |
] |
749 | 187 |
]. |
188 |
^ false |
|
189 |
||
2151 | 190 |
"Created: / 29-07-1997 / 17:39:24 / cg" |
191 |
"Modified: / 16-10-1998 / 01:22:02 / cg" |
|
192 |
"Modified: / 26-07-2011 / 17:54:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
171 | 193 |
! ! |
194 |
||
203 | 195 |
!JavaConstantPool methodsFor:'special'! |
196 |
||
252 | 197 |
classReferencesDo:aBlock |
198 |
self do:[:constItem | |
|
199 |
constItem isJavaClass ifTrue:[ |
|
200 |
aBlock value:constItem |
|
201 |
] |
|
202 |
] |
|
203 |
||
204 |
"Modified: / 7.8.1997 / 19:17:38 / cg" |
|
205 |
"Created: / 4.1.1998 / 00:40:11 / cg" |
|
206 |
! |
|
207 |
||
2151 | 208 |
invalidateAll |
209 |
"go over all entries and call invalidate on all references" |
|
210 |
||
211 |
self do: |
|
212 |
[:entry | |
|
213 |
entry isJavaRef |
|
214 |
ifTrue: [ entry invalidate] ]. |
|
215 |
||
216 |
"Created: / 13-05-2011 / 09:37:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
217 |
! |
|
218 |
||
203 | 219 |
updateClassRefsFrom:oldClass to:newClass |
206 | 220 |
owner == oldClass ifTrue:[ |
221 |
self halt. |
|
222 |
^ self |
|
223 |
]. |
|
224 |
||
203 | 225 |
self keysAndValuesDo:[:index :constItem | |
313 | 226 |
|nameIndex| |
227 |
||
203 | 228 |
constItem == oldClass ifTrue:[ |
229 |
self at:index put:newClass |
|
230 |
] ifFalse:[ |
|
206 | 231 |
(constItem isNil |
232 |
or:[constItem isNumber]) ifFalse:[ |
|
203 | 233 |
constItem isString ifTrue:[ |
234 |
"/ nothing done ... |
|
235 |
] ifFalse:[ |
|
236 |
(constItem isMemberOf:(Java java_lang_String)) ifTrue:[ |
|
237 |
"/ nothing done ... |
|
238 |
] ifFalse:[ |
|
206 | 239 |
constItem isBehavior ifFalse:[ |
203 | 240 |
constItem updateClassRefsFrom:oldClass to:newClass |
206 | 241 |
] ifTrue:[ |
242 |
constItem isJavaClass ifTrue:[ |
|
243 |
constItem fullName = oldClass fullName ifTrue:[ |
|
244 |
'JAVA: class update by name [in pool].' infoPrintCR. |
|
313 | 245 |
newClass isNil ifTrue:[ |
246 |
"/ mhm - must find a slot for the classes name |
|
247 |
nameIndex := -1. |
|
248 |
self |
|
249 |
at:index |
|
250 |
put:(JavaUnresolvedClassConstant |
|
251 |
pool:self |
|
252 |
poolIndex:index |
|
253 |
nameIndex:nameIndex) |
|
254 |
] ifFalse:[ |
|
255 |
self at:index put:newClass |
|
256 |
] |
|
206 | 257 |
] |
258 |
] |
|
203 | 259 |
] |
260 |
] |
|
261 |
] |
|
262 |
] |
|
263 |
] |
|
264 |
] |
|
265 |
||
313 | 266 |
"Modified: / 4.2.1998 / 22:12:03 / cg" |
203 | 267 |
! ! |
268 |
||
135 | 269 |
!JavaConstantPool class methodsFor:'documentation'! |
89 | 270 |
|
271 |
version |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
272 |
^ '$Header: /cvs/stx/stx/libjava/JavaConstantPool.st,v 1.20 2013-09-06 00:41:22 vrany Exp $' |
2213 | 273 |
! |
274 |
||
275 |
version_CVS |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
276 |
^ '$Header: /cvs/stx/stx/libjava/JavaConstantPool.st,v 1.20 2013-09-06 00:41:22 vrany Exp $' |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
277 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
278 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
279 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
280 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2269
diff
changeset
|
281 |
^ '$Changeset: <not expanded> $' |
2151 | 282 |
! |
283 |
||
284 |
version_SVN |
|
2731
13f5be2bf83b
Merged d87e89dd5276 and fe83a843a7bf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
285 |
^ 'Id' |
89 | 286 |
! ! |
2151 | 287 |