author | vranyj1 |
Tue, 18 Oct 2011 15:52:12 +0000 | |
branch | jk_new_structure |
changeset 1022 | 38b710d7dfbc |
parent 923 | b922537eea2a |
child 1152 | 040cba55a7d2 |
permissions | -rw-r--r-- |
752 | 1 |
" |
877 | 2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
3 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
4 |
SWING Research Group, Czech Technical University in Prague |
|
5 |
||
6 |
Parts of the code written by Claus Gittinger are under following |
|
7 |
license: |
|
752 | 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. |
|
877 | 15 |
|
16 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed: |
|
17 |
||
18 |
Permission is hereby granted, free of charge, to any person |
|
19 |
obtaining a copy of this software and associated documentation |
|
20 |
files (the 'Software'), to deal in the Software without |
|
21 |
restriction, including without limitation the rights to use, |
|
22 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
23 |
copies of the Software, and to permit persons to whom the |
|
24 |
Software is furnished to do so, subject to the following |
|
25 |
conditions: |
|
26 |
||
27 |
The above copyright notice and this permission notice shall be |
|
28 |
included in all copies or substantial portions of the Software. |
|
29 |
||
30 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
31 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
32 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
33 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
34 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
35 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
36 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
37 |
OTHER DEALINGS IN THE SOFTWARE. |
|
38 |
||
39 |
[1] Code written at SWING Research Group contain a signature |
|
40 |
of one of the above copright owners. |
|
752 | 41 |
" |
42 |
"{ Package: 'stx:libjava' }" |
|
43 |
||
44 |
Array variableSubclass:#JavaConstantPool |
|
45 |
instanceVariableNames:'owner' |
|
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
46 |
classVariableNames:'ConstantPools' |
752 | 47 |
poolDictionaries:'' |
48 |
category:'Languages-Java-Reader-Support' |
|
49 |
! |
|
50 |
||
51 |
!JavaConstantPool class methodsFor:'documentation'! |
|
52 |
||
53 |
copyright |
|
54 |
" |
|
877 | 55 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
56 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
57 |
SWING Research Group, Czech Technical University in Prague |
|
58 |
||
59 |
Parts of the code written by Claus Gittinger are under following |
|
60 |
license: |
|
752 | 61 |
|
62 |
This software is furnished under a license and may be used |
|
63 |
only in accordance with the terms of that license and with the |
|
64 |
inclusion of the above copyright notice. This software may not |
|
65 |
be provided or otherwise made available to, or used by, any |
|
66 |
other person. No title to or ownership of the software is |
|
67 |
hereby transferred. |
|
877 | 68 |
|
69 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed: |
|
70 |
||
71 |
Permission is hereby granted, free of charge, to any person |
|
72 |
obtaining a copy of this software and associated documentation |
|
73 |
files (the 'Software'), to deal in the Software without |
|
74 |
restriction, including without limitation the rights to use, |
|
75 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
76 |
copies of the Software, and to permit persons to whom the |
|
77 |
Software is furnished to do so, subject to the following |
|
78 |
conditions: |
|
752 | 79 |
|
877 | 80 |
The above copyright notice and this permission notice shall be |
81 |
included in all copies or substantial portions of the Software. |
|
752 | 82 |
|
877 | 83 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
84 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
85 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
86 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
87 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
88 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
89 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
90 |
OTHER DEALINGS IN THE SOFTWARE. |
|
91 |
||
92 |
[1] Code written at SWING Research Group contain a signature |
|
93 |
of one of the above copright owners. |
|
94 |
||
95 |
" |
|
752 | 96 |
! ! |
97 |
||
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
98 |
!JavaConstantPool class methodsFor:'initialization'! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
99 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
100 |
initialize |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
101 |
ConstantPools := OrderedCollection new: 1000. |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
102 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
103 |
"Modified: / 08-04-2011 / 17:28:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
104 |
"Modified: / 09-04-2011 / 09:25:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
105 |
! ! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
106 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
107 |
!JavaConstantPool class methodsFor:'instance creation'! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
108 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
109 |
new: size |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
110 |
"return an initialized instance" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
111 |
|
761 | 112 |
^ ConstantPools add: ((super new: size) |
113 |
initialize; |
|
114 |
yourself). |
|
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
115 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
116 |
"Created: / 08-04-2011 / 16:56:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
117 |
"Modified: / 09-04-2011 / 09:24:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 118 |
"Modified: / 11-04-2011 / 18:46:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
119 |
! ! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
120 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
121 |
!JavaConstantPool class methodsFor:'accessing'! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
122 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
123 |
allConstantPools |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
124 |
"linked list of all constant pools in system" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
125 |
^ ConstantPools. |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
126 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
127 |
"Created: / 08-04-2011 / 16:53:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
128 |
"Modified: / 09-04-2011 / 09:24:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
129 |
! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
130 |
|
761 | 131 |
allConstantPools: anOorderedCollection |
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
132 |
"linked list of all constant pools in system" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
133 |
|
761 | 134 |
ConstantPools := anOorderedCollection. |
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
135 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
136 |
"Created: / 08-04-2011 / 17:07:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
137 |
"Modified: / 09-04-2011 / 09:24:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 138 |
"Modified: / 11-04-2011 / 18:47:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
139 |
! ! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
140 |
|
752 | 141 |
!JavaConstantPool class methodsFor:'special'! |
142 |
||
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
143 |
invalidateForClass: internalJavaClassName |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
144 |
"Only alias, everybody calls invalidateForClass so why not me :)" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
145 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
146 |
^self invalidateReferencesToClass: internalJavaClassName. |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
147 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
148 |
"Created: / 08-04-2011 / 16:52:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
149 |
! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
150 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
151 |
invalidateReferencesToClass: internalJavaClassName |
758 | 152 |
"Go over all constant pools and call invalidateForClass on all |
153 |
references. (usable when given class was unloaded etc)" |
|
154 |
ConstantPools do: [:each | each invalidateForClass: internalJavaClassName]. |
|
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
155 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
156 |
"Created: / 08-04-2011 / 16:09:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 157 |
! ! |
158 |
||
159 |
!JavaConstantPool methodsFor:'accessing'! |
|
160 |
||
161 |
owner |
|
162 |
"return owner" |
|
163 |
||
164 |
^ owner |
|
165 |
||
166 |
"Created: 28.6.1996 / 21:12:22 / cg" |
|
167 |
! |
|
168 |
||
169 |
owner:something |
|
170 |
"set owner" |
|
171 |
||
172 |
owner := something. |
|
173 |
||
174 |
"Created: 28.6.1996 / 21:12:22 / cg" |
|
175 |
! ! |
|
176 |
||
778
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
177 |
!JavaConstantPool methodsFor:'adding'! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
178 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
179 |
at: classRefIndex putClassRefWithNameAt: classNameIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
180 |
self at: classRefIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
181 |
put: (JavaClassRef2 in: self withNameAt: classNameIndex). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
182 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
183 |
"Created: / 13-05-2011 / 09:48:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
184 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
185 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
186 |
at: fieldRefIndex putFieldRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
187 |
self at: fieldRefIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
188 |
put: (JavaFieldRef2 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
189 |
in: self |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
190 |
withNameAndTypeAt: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
191 |
andClassAt: classRefIndex). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
192 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
193 |
"Created: / 13-05-2011 / 09:08:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
194 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
195 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
196 |
at: interfaceMethodRefIndex putInterfaceMethodRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
197 |
self at: interfaceMethodRefIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
198 |
put: (JavaInterfaceMethodRef2 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
199 |
in: self |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
200 |
withNameAndTypeAt: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
201 |
andClassAt: classRefIndex). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
202 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
203 |
"Created: / 13-05-2011 / 09:08:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
204 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
205 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
206 |
at: methodRefIndex putMethodRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
207 |
self at: methodRefIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
208 |
put: (JavaMethodRef2 in: self withNameAndTypeAt: nameAndTypeIndex andClassAt:classRefIndex). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
209 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
210 |
"Created: / 13-05-2011 / 09:07:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
211 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
212 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
213 |
at: nameAndTypeIndex putNameAndTypeWithNameAt: nameIndex andDescriptorAt: descriptorIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
214 |
self at: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
215 |
put: (JavaNameAndType2 in: self withNameAt: nameIndex andDescriptorAt: descriptorIndex). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
216 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
217 |
"Created: / 13-05-2011 / 09:05:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
218 |
! ! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
219 |
|
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
220 |
!JavaConstantPool methodsFor:'initialization'! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
221 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
222 |
initialize |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
223 |
"Invoked when a new instance is created." |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
224 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
225 |
"/ please change as required (and remove this comment) |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
226 |
"/ owner := nil. |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
227 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
228 |
"/ super initialize. -- commented since inherited method does nothing |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
229 |
! ! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
230 |
|
752 | 231 |
!JavaConstantPool methodsFor:'printing & storing'! |
232 |
||
233 |
displayString |
|
234 |
owner isNil ifTrue:[ |
|
235 |
^ '*** unowned ConstantPool' |
|
236 |
]. |
|
237 |
^ 'ConstantPool of ' , owner fullName |
|
238 |
||
239 |
"Created: 28.6.1996 / 21:13:41 / cg" |
|
240 |
"Modified: 28.6.1996 / 21:20:26 / cg" |
|
241 |
! ! |
|
242 |
||
243 |
!JavaConstantPool methodsFor:'queries'! |
|
244 |
||
245 |
refersToMethod:aJavaMethod |
|
878
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
246 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
247 |
self error: 'JV@2011-07-26: Update to new resolving scheme!!'. |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
248 |
|
752 | 249 |
self do:[:constItem | |
250 |
(constItem == aJavaMethod) ifTrue:[^ true]. |
|
878
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
251 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
252 |
]. |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
253 |
^ false |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
254 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
255 |
"Created: / 29-07-1997 / 17:39:19 / cg" |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
256 |
"Modified: / 26-07-2011 / 18:00:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
257 |
! |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
258 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
259 |
refersToMethodNamed:aJavaMethodName |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
260 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
261 |
self error: 'JV@2011-07-26: Update to new resolving scheme!!'. |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
262 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
263 |
self do:[:constItem | |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
264 |
(constItem isKindOf:JavaMethod) ifTrue:[ |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
265 |
constItem name = aJavaMethodName ifTrue:[^ true]. |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
266 |
] ifFalse:[ |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
267 |
|
752 | 268 |
] |
269 |
]. |
|
270 |
^ false |
|
271 |
||
878
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
272 |
"Created: / 29-07-1997 / 17:39:24 / cg" |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
273 |
"Modified: / 16-10-1998 / 01:22:02 / cg" |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
274 |
"Modified: / 26-07-2011 / 17:54:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 275 |
! ! |
276 |
||
277 |
!JavaConstantPool methodsFor:'special'! |
|
278 |
||
279 |
classReferencesDo:aBlock |
|
280 |
self do:[:constItem | |
|
281 |
constItem isJavaClass ifTrue:[ |
|
282 |
aBlock value:constItem |
|
283 |
] |
|
284 |
] |
|
285 |
||
286 |
"Modified: / 7.8.1997 / 19:17:38 / cg" |
|
287 |
"Created: / 4.1.1998 / 00:40:11 / cg" |
|
288 |
! |
|
289 |
||
778
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
290 |
invalidateAll |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
291 |
"go over all entries and call invalidate on all references" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
292 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
293 |
self do: |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
294 |
[:entry | |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
295 |
entry isJavaRef |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
296 |
ifTrue: [ entry invalidate] ]. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
297 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
298 |
"Created: / 13-05-2011 / 09:37:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
299 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
300 |
|
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
301 |
invalidateForClass: internalJavaClassName |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
302 |
"go over all entries and call invalidateForClass on all references" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
303 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
304 |
self do: [:entry | entry isJavaRef ifTrue:[entry invalidateForClass: internalJavaClassName]]. |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
305 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
306 |
"Created: / 08-04-2011 / 16:11:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
307 |
! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
308 |
|
752 | 309 |
updateClassRefsFrom:oldClass to:newClass |
310 |
owner == oldClass ifTrue:[ |
|
311 |
self halt. |
|
312 |
^ self |
|
313 |
]. |
|
314 |
||
315 |
self keysAndValuesDo:[:index :constItem | |
|
316 |
|nameIndex| |
|
317 |
||
318 |
constItem == oldClass ifTrue:[ |
|
319 |
self at:index put:newClass |
|
320 |
] ifFalse:[ |
|
321 |
(constItem isNil |
|
322 |
or:[constItem isNumber]) ifFalse:[ |
|
323 |
constItem isString ifTrue:[ |
|
324 |
"/ nothing done ... |
|
325 |
] ifFalse:[ |
|
326 |
(constItem isMemberOf:(Java java_lang_String)) ifTrue:[ |
|
327 |
"/ nothing done ... |
|
328 |
] ifFalse:[ |
|
329 |
constItem isBehavior ifFalse:[ |
|
330 |
constItem updateClassRefsFrom:oldClass to:newClass |
|
331 |
] ifTrue:[ |
|
332 |
constItem isJavaClass ifTrue:[ |
|
333 |
constItem fullName = oldClass fullName ifTrue:[ |
|
334 |
'JAVA: class update by name [in pool].' infoPrintCR. |
|
335 |
newClass isNil ifTrue:[ |
|
336 |
"/ mhm - must find a slot for the classes name |
|
337 |
nameIndex := -1. |
|
338 |
self |
|
339 |
at:index |
|
340 |
put:(JavaUnresolvedClassConstant |
|
341 |
pool:self |
|
342 |
poolIndex:index |
|
343 |
nameIndex:nameIndex) |
|
344 |
] ifFalse:[ |
|
345 |
self at:index put:newClass |
|
346 |
] |
|
347 |
] |
|
348 |
] |
|
349 |
] |
|
350 |
] |
|
351 |
] |
|
352 |
] |
|
353 |
] |
|
354 |
] |
|
355 |
||
356 |
"Modified: / 4.2.1998 / 22:12:03 / cg" |
|
357 |
! ! |
|
358 |
||
359 |
!JavaConstantPool class methodsFor:'documentation'! |
|
360 |
||
361 |
version |
|
1022 | 362 |
^ '$Id$' |
752 | 363 |
! |
364 |
||
365 |
version_SVN |
|
1022 | 366 |
^ '$Id$' |
752 | 367 |
! ! |
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
368 |
|
923 | 369 |
JavaConstantPool initialize! |