|
1 " |
|
2 COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
3 |
|
4 New code and modifications done at SWING Research Group [1]: |
|
5 |
|
6 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
7 SWING Research Group, Czech Technical University in Prague |
|
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. |
|
15 |
|
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 |
|
19 as of 1.9.2010 |
|
20 " |
|
21 "{ Package: 'stx:libjava' }" |
|
22 |
|
23 Object subclass:#JavaNameAndType2 |
|
24 instanceVariableNames:'constantPool nameIndex descriptorIndex nameCache descriptorCache' |
|
25 classVariableNames:'' |
|
26 poolDictionaries:'' |
|
27 category:'Languages-Java-Reader-Support-new' |
|
28 ! |
|
29 |
|
30 !JavaNameAndType2 class methodsFor:'documentation'! |
|
31 |
|
32 copyright |
|
33 " |
|
34 COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
35 |
|
36 New code and modifications done at SWING Research Group [1]: |
|
37 |
|
38 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
39 SWING Research Group, Czech Technical University in Prague |
|
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. |
|
47 |
|
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 |
|
51 as of 1.9.2010 |
|
52 |
|
53 " |
|
54 ! ! |
|
55 |
|
56 !JavaNameAndType2 class methodsFor:'instance creation'! |
|
57 |
|
58 in: aJavaConstantPool withNameAt: arg1 andDescriptorAt: arg2 |
|
59 "Create & return a new instance for arg." |
|
60 |
|
61 ^ self basicNew |
|
62 initializeIn: aJavaConstantPool |
|
63 withNameAt: arg1 |
|
64 andDescriptorAt: arg2 |
|
65 |
|
66 "Created: / 10-05-2011 / 15:45:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
67 ! ! |
|
68 |
|
69 !JavaNameAndType2 methodsFor:'* As yet uncategorized *'! |
|
70 |
|
71 invalidateForClass:aSymbol |
|
72 "Name and type cannot be invalid..." |
|
73 |
|
74 ^false |
|
75 |
|
76 "Created: / 22-02-2012 / 20:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
77 ! ! |
|
78 |
|
79 !JavaNameAndType2 methodsFor:'accessing'! |
|
80 |
|
81 constantPool |
|
82 ^constantPool. |
|
83 |
|
84 "Created: / 10-05-2011 / 17:16:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
85 ! |
|
86 |
|
87 constantPool: aJavaConstantPool |
|
88 constantPool := aJavaConstantPool. |
|
89 |
|
90 "Created: / 10-05-2011 / 17:16:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
91 ! |
|
92 |
|
93 descriptor |
|
94 ^constantPool at: descriptorIndex. |
|
95 |
|
96 "Created: / 08-04-2011 / 11:55:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
97 "Modified: / 12-05-2011 / 18:51:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
98 ! |
|
99 |
|
100 name |
|
101 ^ constantPool at: nameIndex. |
|
102 |
|
103 "Created: / 08-04-2011 / 11:55:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
104 "Modified: / 12-05-2011 / 18:42:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
105 ! |
|
106 |
|
107 owner |
|
108 ^ constantPool owner. |
|
109 |
|
110 "Created: / 12-05-2011 / 18:43:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
111 ! |
|
112 |
|
113 owner: javaClass |
|
114 constantPool owner: javaClass. |
|
115 |
|
116 "Created: / 12-05-2011 / 18:43:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
117 ! |
|
118 |
|
119 selector |
|
120 ^ (self name , self descriptor) asSymbol. |
|
121 |
|
122 "Created: / 11-04-2011 / 21:31:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
123 "Modified: / 12-05-2011 / 18:51:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
124 ! ! |
|
125 |
|
126 !JavaNameAndType2 methodsFor:'backward compatibility'! |
|
127 |
|
128 isUnresolved |
|
129 ^false. |
|
130 |
|
131 "Created: / 13-05-2011 / 18:43:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
132 ! |
|
133 |
|
134 signature |
|
135 ^self descriptor. |
|
136 |
|
137 "Created: / 13-05-2011 / 18:45:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
138 ! ! |
|
139 |
|
140 !JavaNameAndType2 methodsFor:'comparing'! |
|
141 |
|
142 = aNameAndType |
|
143 self name ~= aNameAndType name ifTrue: [ ^ false ]. |
|
144 ^ self descriptor = aNameAndType descriptor. |
|
145 |
|
146 "Created: / 08-04-2011 / 11:56:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
147 "Modified: / 12-05-2011 / 18:44:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
148 ! |
|
149 |
|
150 hash |
|
151 ^ self name hash bitXor: self descriptor hash. |
|
152 |
|
153 "Created: / 08-04-2011 / 11:57:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
154 "Modified: / 12-05-2011 / 18:44:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
155 ! ! |
|
156 |
|
157 !JavaNameAndType2 methodsFor:'initialization'! |
|
158 |
|
159 initializeIn: aJavaConstantPool withNameAt: nameCPIndex andDescriptorAt: descriptorCPIndex |
|
160 nameIndex := nameCPIndex. |
|
161 descriptorIndex := descriptorCPIndex. |
|
162 constantPool := aJavaConstantPool. |
|
163 super initialize. |
|
164 |
|
165 "Created: / 10-05-2011 / 15:45:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
166 ! ! |
|
167 |
|
168 !JavaNameAndType2 methodsFor:'logging'! |
|
169 |
|
170 info: arg |
|
171 |
|
172 Logger log: arg severity: #info facility: 'JVM' |
|
173 |
|
174 "Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
175 "Modified: / 14-09-2011 / 21:42:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
176 ! |
|
177 |
|
178 warning: arg |
|
179 |
|
180 Logger log: arg severity: #warn facility: 'JVM' |
|
181 |
|
182 "Created: / 10-05-2011 / 15:01:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
183 "Modified: / 14-09-2011 / 21:42:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
184 ! ! |
|
185 |
|
186 !JavaNameAndType2 methodsFor:'printing'! |
|
187 |
|
188 printString |
|
189 ^ 'JavaNameAndType name=' , self name printString , ' descriptor= ' |
|
190 , self descriptor printString. |
|
191 |
|
192 "Created: / 10-05-2011 / 14:17:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
193 "Modified: / 12-05-2011 / 18:44:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
194 ! ! |
|
195 |
|
196 !JavaNameAndType2 methodsFor:'queries'! |
|
197 |
|
198 isJavaNameAndType |
|
199 "return true, if given object represents name and type struct in java constant pool" |
|
200 |
|
201 ^ true. |
|
202 |
|
203 "Created: / 10-05-2011 / 12:23:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
204 ! |
|
205 |
|
206 isNewJavaNameAndType |
|
207 "only temporary, to know if name and type is old (claus' version) or new (m version)" |
|
208 |
|
209 ^ true. |
|
210 |
|
211 "Created: / 10-05-2011 / 12:24:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
212 ! ! |
|
213 |
|
214 !JavaNameAndType2 methodsFor:'resolving'! |
|
215 |
|
216 preresolve |
|
217 self resolve |
|
218 |
|
219 "Created: / 15-10-2012 / 23:09:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
220 ! |
|
221 |
|
222 resolve |
|
223 nameCache := constantPool at: nameIndex. |
|
224 descriptorCache := constantPool at: descriptorIndex. |
|
225 (nameCache isNil or: [ descriptorCache isNil ]) |
|
226 ifTrue: [ self breakPoint: #mh ]. |
|
227 ^self. |
|
228 |
|
229 "Created: / 18-05-2011 / 13:19:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
230 ! |
|
231 |
|
232 resolve: doClassInit |
|
233 ^ self resolve. |
|
234 |
|
235 "Created: / 18-05-2011 / 13:19:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
236 "Created: / 23-02-2012 / 17:14:51 / Marcel Hlopko <hlopik@gmail.com>" |
|
237 ! |
|
238 |
|
239 updateClassRefsFrom: oldOwner to: newOwner |
|
240 self owner = oldOwner ifTrue: [ |
|
241 self owner: newOwner. |
|
242 ]. |
|
243 |
|
244 "Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
245 "Modified: / 04-06-2011 / 18:40:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
246 ! ! |
|
247 |
|
248 !JavaNameAndType2 class methodsFor:'documentation'! |
|
249 |
|
250 version_SVN |
|
251 ^ '$Id$' |
|
252 ! ! |