author | vranyj1 |
Wed, 23 Nov 2011 15:26:06 +0000 | |
branch | jk_new_structure |
changeset 1152 | 040cba55a7d2 |
parent 1022 | 38b710d7dfbc |
child 1155 | d6f6d5fc0343 |
permissions | -rw-r--r-- |
752 | 1 |
" |
877 | 2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 3 |
|
4 |
New code and modification done at SWING Research Group [1]: |
|
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 |
||
9 |
Parts of the code written by Claus Gittinger are under following |
|
10 |
license: |
|
752 | 11 |
|
12 |
This software is furnished under a license and may be used |
|
13 |
only in accordance with the terms of that license and with the |
|
14 |
inclusion of the above copyright notice. This software may not |
|
15 |
be provided or otherwise made available to, or used by, any |
|
16 |
other person. No title to or ownership of the software is |
|
17 |
hereby transferred. |
|
877 | 18 |
|
19 |
[1] Code written at SWING Research Group contain a signature |
|
1152 | 20 |
of one of the above copright owners. For exact set of such code |
21 |
see the differences between this version and version stx:lib |
|
22 |
as of 1.9.2010 |
|
752 | 23 |
" |
24 |
"{ Package: 'stx:libjava' }" |
|
25 |
||
26 |
Array variableSubclass:#JavaConstantPool |
|
27 |
instanceVariableNames:'owner' |
|
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
28 |
classVariableNames:'ConstantPools' |
752 | 29 |
poolDictionaries:'' |
30 |
category:'Languages-Java-Reader-Support' |
|
31 |
! |
|
32 |
||
33 |
!JavaConstantPool class methodsFor:'documentation'! |
|
34 |
||
35 |
copyright |
|
36 |
" |
|
877 | 37 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 38 |
|
39 |
New code and modification done at SWING Research Group [1]: |
|
40 |
||
877 | 41 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
42 |
SWING Research Group, Czech Technical University in Prague |
|
43 |
||
44 |
Parts of the code written by Claus Gittinger are under following |
|
45 |
license: |
|
752 | 46 |
|
47 |
This software is furnished under a license and may be used |
|
48 |
only in accordance with the terms of that license and with the |
|
49 |
inclusion of the above copyright notice. This software may not |
|
50 |
be provided or otherwise made available to, or used by, any |
|
51 |
other person. No title to or ownership of the software is |
|
52 |
hereby transferred. |
|
877 | 53 |
|
54 |
[1] Code written at SWING Research Group contain a signature |
|
1152 | 55 |
of one of the above copright owners. For exact set of such code |
56 |
see the differences between this version and version stx:lib |
|
57 |
as of 1.9.2010 |
|
877 | 58 |
|
59 |
" |
|
752 | 60 |
! ! |
61 |
||
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
62 |
!JavaConstantPool class methodsFor:'initialization'! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
63 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
64 |
initialize |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
65 |
ConstantPools := OrderedCollection new: 1000. |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
66 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
67 |
"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
|
68 |
"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
|
69 |
! ! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
70 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
71 |
!JavaConstantPool class methodsFor:'instance creation'! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
72 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
73 |
new: size |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
74 |
"return an initialized instance" |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
75 |
|
761 | 76 |
^ ConstantPools add: ((super new: size) |
77 |
initialize; |
|
78 |
yourself). |
|
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
79 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
80 |
"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
|
81 |
"Modified: / 09-04-2011 / 09:24:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 82 |
"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
|
83 |
! ! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
84 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
85 |
!JavaConstantPool class methodsFor:'accessing'! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
86 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
87 |
allConstantPools |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
88 |
"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
|
89 |
^ ConstantPools. |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
90 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
91 |
"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
|
92 |
"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
|
93 |
! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
94 |
|
761 | 95 |
allConstantPools: anOorderedCollection |
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
96 |
"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
|
97 |
|
761 | 98 |
ConstantPools := anOorderedCollection. |
757
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 |
"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
|
101 |
"Modified: / 09-04-2011 / 09:24:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 102 |
"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
|
103 |
! ! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
104 |
|
752 | 105 |
!JavaConstantPool class methodsFor:'special'! |
106 |
||
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
107 |
invalidateForClass: internalJavaClassName |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
108 |
"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
|
109 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
110 |
^self invalidateReferencesToClass: internalJavaClassName. |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
111 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
112 |
"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
|
113 |
! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
114 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
115 |
invalidateReferencesToClass: internalJavaClassName |
758 | 116 |
"Go over all constant pools and call invalidateForClass on all |
117 |
references. (usable when given class was unloaded etc)" |
|
118 |
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
|
119 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
120 |
"Created: / 08-04-2011 / 16:09:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 121 |
! ! |
122 |
||
123 |
!JavaConstantPool methodsFor:'accessing'! |
|
124 |
||
125 |
owner |
|
126 |
"return owner" |
|
127 |
||
128 |
^ owner |
|
129 |
||
130 |
"Created: 28.6.1996 / 21:12:22 / cg" |
|
131 |
! |
|
132 |
||
133 |
owner:something |
|
134 |
"set owner" |
|
135 |
||
136 |
owner := something. |
|
137 |
||
138 |
"Created: 28.6.1996 / 21:12:22 / cg" |
|
139 |
! ! |
|
140 |
||
778
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
141 |
!JavaConstantPool methodsFor:'adding'! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
142 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
143 |
at: classRefIndex putClassRefWithNameAt: classNameIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
144 |
self at: classRefIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
145 |
put: (JavaClassRef2 in: self withNameAt: classNameIndex). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
146 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
147 |
"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
|
148 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
149 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
150 |
at: fieldRefIndex putFieldRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
151 |
self at: fieldRefIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
152 |
put: (JavaFieldRef2 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
153 |
in: self |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
154 |
withNameAndTypeAt: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
155 |
andClassAt: classRefIndex). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
156 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
157 |
"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
|
158 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
159 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
160 |
at: interfaceMethodRefIndex putInterfaceMethodRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
161 |
self at: interfaceMethodRefIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
162 |
put: (JavaInterfaceMethodRef2 |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
163 |
in: self |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
164 |
withNameAndTypeAt: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
165 |
andClassAt: classRefIndex). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
166 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
167 |
"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
|
168 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
169 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
170 |
at: methodRefIndex putMethodRefWithClassAt: classRefIndex andNameAndTypeAt: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
171 |
self at: methodRefIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
172 |
put: (JavaMethodRef2 in: self withNameAndTypeAt: nameAndTypeIndex andClassAt:classRefIndex). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
173 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
174 |
"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
|
175 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
176 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
177 |
at: nameAndTypeIndex putNameAndTypeWithNameAt: nameIndex andDescriptorAt: descriptorIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
178 |
self at: nameAndTypeIndex |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
179 |
put: (JavaNameAndType2 in: self withNameAt: nameIndex andDescriptorAt: descriptorIndex). |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
180 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
181 |
"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
|
182 |
! ! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
183 |
|
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
184 |
!JavaConstantPool methodsFor:'initialization'! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
185 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
186 |
initialize |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
187 |
"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
|
188 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
189 |
"/ 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
|
190 |
"/ owner := nil. |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
191 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
192 |
"/ 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
|
193 |
! ! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
194 |
|
752 | 195 |
!JavaConstantPool methodsFor:'printing & storing'! |
196 |
||
197 |
displayString |
|
198 |
owner isNil ifTrue:[ |
|
199 |
^ '*** unowned ConstantPool' |
|
200 |
]. |
|
201 |
^ 'ConstantPool of ' , owner fullName |
|
202 |
||
203 |
"Created: 28.6.1996 / 21:13:41 / cg" |
|
204 |
"Modified: 28.6.1996 / 21:20:26 / cg" |
|
205 |
! ! |
|
206 |
||
207 |
!JavaConstantPool methodsFor:'queries'! |
|
208 |
||
209 |
refersToMethod:aJavaMethod |
|
878
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
210 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
211 |
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
|
212 |
|
752 | 213 |
self do:[:constItem | |
214 |
(constItem == aJavaMethod) ifTrue:[^ true]. |
|
878
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
215 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
216 |
]. |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
217 |
^ false |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
218 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
219 |
"Created: / 29-07-1997 / 17:39:19 / cg" |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
220 |
"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
|
221 |
! |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
222 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
223 |
refersToMethodNamed:aJavaMethodName |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
224 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
225 |
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
|
226 |
|
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
227 |
self do:[:constItem | |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
228 |
(constItem isKindOf:JavaMethod) ifTrue:[ |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
229 |
constItem name = aJavaMethodName ifTrue:[^ true]. |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
230 |
] ifFalse:[ |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
231 |
|
752 | 232 |
] |
233 |
]. |
|
234 |
^ false |
|
235 |
||
878
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
236 |
"Created: / 29-07-1997 / 17:39:24 / cg" |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
237 |
"Modified: / 16-10-1998 / 01:22:02 / cg" |
b972cc489a01
Cleanup phase 2: Unused *Ref and *UnresolvedConstant removed.
vranyj1
parents:
877
diff
changeset
|
238 |
"Modified: / 26-07-2011 / 17:54:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 239 |
! ! |
240 |
||
241 |
!JavaConstantPool methodsFor:'special'! |
|
242 |
||
243 |
classReferencesDo:aBlock |
|
244 |
self do:[:constItem | |
|
245 |
constItem isJavaClass ifTrue:[ |
|
246 |
aBlock value:constItem |
|
247 |
] |
|
248 |
] |
|
249 |
||
250 |
"Modified: / 7.8.1997 / 19:17:38 / cg" |
|
251 |
"Created: / 4.1.1998 / 00:40:11 / cg" |
|
252 |
! |
|
253 |
||
778
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
254 |
invalidateAll |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
255 |
"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
|
256 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
257 |
self do: |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
258 |
[:entry | |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
259 |
entry isJavaRef |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
260 |
ifTrue: [ entry invalidate] ]. |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
261 |
|
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
262 |
"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
|
263 |
! |
caa3a009f617
refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents:
772
diff
changeset
|
264 |
|
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
265 |
invalidateForClass: internalJavaClassName |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
266 |
"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
|
267 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
268 |
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
|
269 |
|
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
270 |
"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
|
271 |
! |
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
272 |
|
752 | 273 |
updateClassRefsFrom:oldClass to:newClass |
274 |
owner == oldClass ifTrue:[ |
|
275 |
self halt. |
|
276 |
^ self |
|
277 |
]. |
|
278 |
||
279 |
self keysAndValuesDo:[:index :constItem | |
|
280 |
|nameIndex| |
|
281 |
||
282 |
constItem == oldClass ifTrue:[ |
|
283 |
self at:index put:newClass |
|
284 |
] ifFalse:[ |
|
285 |
(constItem isNil |
|
286 |
or:[constItem isNumber]) ifFalse:[ |
|
287 |
constItem isString ifTrue:[ |
|
288 |
"/ nothing done ... |
|
289 |
] ifFalse:[ |
|
290 |
(constItem isMemberOf:(Java java_lang_String)) ifTrue:[ |
|
291 |
"/ nothing done ... |
|
292 |
] ifFalse:[ |
|
293 |
constItem isBehavior ifFalse:[ |
|
294 |
constItem updateClassRefsFrom:oldClass to:newClass |
|
295 |
] ifTrue:[ |
|
296 |
constItem isJavaClass ifTrue:[ |
|
297 |
constItem fullName = oldClass fullName ifTrue:[ |
|
298 |
'JAVA: class update by name [in pool].' infoPrintCR. |
|
299 |
newClass isNil ifTrue:[ |
|
300 |
"/ mhm - must find a slot for the classes name |
|
301 |
nameIndex := -1. |
|
302 |
self |
|
303 |
at:index |
|
304 |
put:(JavaUnresolvedClassConstant |
|
305 |
pool:self |
|
306 |
poolIndex:index |
|
307 |
nameIndex:nameIndex) |
|
308 |
] ifFalse:[ |
|
309 |
self at:index put:newClass |
|
310 |
] |
|
311 |
] |
|
312 |
] |
|
313 |
] |
|
314 |
] |
|
315 |
] |
|
316 |
] |
|
317 |
] |
|
318 |
] |
|
319 |
||
320 |
"Modified: / 4.2.1998 / 22:12:03 / cg" |
|
321 |
! ! |
|
322 |
||
323 |
!JavaConstantPool class methodsFor:'documentation'! |
|
324 |
||
325 |
version |
|
1022 | 326 |
^ '$Id$' |
752 | 327 |
! |
328 |
||
329 |
version_SVN |
|
1022 | 330 |
^ '$Id$' |
752 | 331 |
! ! |
757
b98b1cd769c0
JavaConstantPool: bug fix: JavaConstanPool new: size did not return a constant pool
vranyj1
parents:
752
diff
changeset
|
332 |
|
1152 | 333 |
JavaConstantPool initialize! |