author | vranyj1 |
Tue, 28 Feb 2012 22:29:54 +0000 | |
branch | jk_new_structure |
changeset 1391 | 3843bb5881e8 |
parent 1378 | 9d64d8357509 |
child 1461 | 34a9c99d0295 |
permissions | -rw-r--r-- |
877 | 1 |
" |
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 |
||
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 |
||
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 |
877 | 20 |
" |
752 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
774 | 23 |
Object subclass:#JavaRef2 |
777 | 24 |
instanceVariableNames:'valueCache constantPool' |
752 | 25 |
classVariableNames:'' |
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Reader-Support-new' |
|
28 |
! |
|
29 |
||
758 | 30 |
!JavaRef2 class methodsFor:'documentation'! |
31 |
||
877 | 32 |
copyright |
33 |
" |
|
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 |
||
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 |
||
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 |
" |
|
758 | 54 |
! ! |
752 | 55 |
|
56 |
!JavaRef2 class methodsFor:'instance creation'! |
|
57 |
||
58 |
new |
|
758 | 59 |
"Don't call me directly" |
60 |
||
761 | 61 |
'[JavaRef] Dont instantiate me with new. Call my custom overriden object creation method' |
62 |
infoPrintCR. |
|
1226 | 63 |
|
761 | 64 |
^ self basicNew initialize. |
752 | 65 |
|
1226 | 66 |
"Modified: / 06-12-2011 / 17:02:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 67 |
! ! |
68 |
||
69 |
!JavaRef2 methodsFor:'accessing'! |
|
70 |
||
774 | 71 |
constantPool |
72 |
^constantPool. |
|
73 |
||
74 |
"Created: / 10-05-2011 / 17:16:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
75 |
! |
|
76 |
||
77 |
constantPool: aJavaConstantPool |
|
78 |
constantPool := aJavaConstantPool. |
|
79 |
||
80 |
"Created: / 10-05-2011 / 17:16:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
81 |
! |
|
82 |
||
752 | 83 |
isResolved |
758 | 84 |
^ valueCache isNil not. |
752 | 85 |
|
86 |
"Created: / 08-04-2011 / 11:36:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
758 | 87 |
"Modified: / 08-04-2011 / 17:39:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
88 |
! |
|
89 |
||
90 |
name |
|
91 |
^ self subclassResponsibility. |
|
92 |
||
93 |
"Created: / 08-04-2011 / 13:53:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
94 |
! |
|
95 |
||
774 | 96 |
owner |
777 | 97 |
^ constantPool owner. |
98 |
||
99 |
"Modified: / 12-05-2011 / 18:31:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
774 | 100 |
! |
101 |
||
777 | 102 |
owner: javaClass |
103 |
constantPool owner: javaClass. |
|
104 |
||
105 |
"Modified: / 12-05-2011 / 18:32:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
774 | 106 |
! |
107 |
||
752 | 108 |
valueCache |
109 |
^ valueCache. |
|
110 |
||
111 |
"Created: / 08-04-2011 / 11:37:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
112 |
! ! |
|
113 |
||
114 |
!JavaRef2 methodsFor:'comparing'! |
|
115 |
||
116 |
= anotherJavaRef |
|
117 |
^ self subclassResponsibility. |
|
118 |
||
119 |
"Created: / 08-04-2011 / 12:15:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
120 |
! |
|
121 |
||
122 |
hash |
|
123 |
||
124 |
^ self subclassResponsibility. |
|
125 |
||
126 |
"Created: / 08-04-2011 / 12:15:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
127 |
! ! |
|
128 |
||
129 |
!JavaRef2 methodsFor:'initialization'! |
|
130 |
||
131 |
initialize |
|
132 |
valueCache := nil. |
|
133 |
super initialize. |
|
134 |
||
758 | 135 |
"Modified: / 08-04-2011 / 17:39:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 136 |
! ! |
137 |
||
774 | 138 |
!JavaRef2 methodsFor:'logging'! |
139 |
||
1000 | 140 |
info: arg |
141 |
||
142 |
Logger log: arg severity: #info facility: 'JVM' |
|
774 | 143 |
|
144 |
"Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1000 | 145 |
"Modified: / 14-09-2011 / 21:47:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
774 | 146 |
! |
147 |
||
148 |
warning: arg |
|
1000 | 149 |
|
150 |
Logger log: arg severity: #warn facility: 'JVM' |
|
774 | 151 |
|
152 |
"Created: / 10-05-2011 / 15:01:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1000 | 153 |
"Modified: / 14-09-2011 / 21:47:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
774 | 154 |
! ! |
155 |
||
915 | 156 |
!JavaRef2 methodsFor:'printing'! |
157 |
||
158 |
displayString |
|
159 |
||
160 |
^self subclassResponsibility |
|
161 |
||
162 |
"Created: / 14-08-2011 / 21:18:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
163 |
! ! |
|
164 |
||
774 | 165 |
!JavaRef2 methodsFor:'private - resolving'! |
166 |
||
167 |
findResolvedValue |
|
1353 | 168 |
self findResolvedValue: true. |
169 |
||
170 |
"Modified: / 09-02-2012 / 23:10:09 / mh <hlopik@gmail.com>" |
|
171 |
! |
|
774 | 172 |
|
1353 | 173 |
findResolvedValue:arg |
174 |
self shouldImplement |
|
175 |
||
176 |
"Created: / 09-02-2012 / 23:08:15 / mh <hlopik@gmail.com>" |
|
774 | 177 |
! ! |
178 |
||
758 | 179 |
!JavaRef2 methodsFor:'queries'! |
180 |
||
181 |
isJavaRef |
|
182 |
"return true if object represents reference in java constant pool" |
|
183 |
^ true. |
|
184 |
||
185 |
"Created: / 08-04-2011 / 16:15:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
771 | 186 |
! |
187 |
||
188 |
isNewJavaRef |
|
189 |
"only temporary, to know if ref is old (claus' version) or new (m version)" |
|
190 |
||
191 |
^ true. |
|
192 |
||
193 |
"Created: / 10-05-2011 / 12:20:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
758 | 194 |
! ! |
195 |
||
752 | 196 |
!JavaRef2 methodsFor:'resolving'! |
197 |
||
198 |
invalidate |
|
758 | 199 |
"Invalidate reference. Cache will be cleared and next call to resolve will cause resolving from scratch." |
200 |
||
201 |
valueCache := nil. |
|
752 | 202 |
|
203 |
"Created: / 08-04-2011 / 11:42:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
758 | 204 |
"Modified: / 08-04-2011 / 17:39:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
205 |
! |
|
206 |
||
207 |
invalidateForClass: internalJavaClassName |
|
1372
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1353
diff
changeset
|
208 |
"Invalidates receiver iff it refers (even indirectly) |
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1353
diff
changeset
|
209 |
to a class ref that has been resolved to given class. |
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1353
diff
changeset
|
210 |
Returns true, if the receiver has been invalidated, |
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1353
diff
changeset
|
211 |
false otherwise" |
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1353
diff
changeset
|
212 |
|
758 | 213 |
^ self subclassResponsibility. |
214 |
||
215 |
"Created: / 08-04-2011 / 15:59:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1372
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1353
diff
changeset
|
216 |
"Modified (comment): / 21-02-2012 / 10:20:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 217 |
! |
218 |
||
219 |
resolve |
|
220 |
" |
|
221 |
Do it all method - resolves current reference and returns expected element (JavaMethod, JavaField etc.) |
|
222 |
Hides implementation details of the way of dealing with invalidation etc. User should not need to call anything |
|
223 |
else." |
|
224 |
||
1378 | 225 |
self resolve: true. |
752 | 226 |
^ valueCache. |
227 |
||
228 |
"Created: / 08-04-2011 / 11:30:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1378 | 229 |
"Modified: / 23-02-2012 / 17:21:39 / Marcel Hlopko <hlopik@gmail.com>" |
761 | 230 |
! |
231 |
||
1353 | 232 |
resolve: doClassInit |
1391 | 233 |
"Do it all method - resolves current reference and returns expected element (JavaMethod, JavaField etc.) |
234 |
If doClassInit is true, resolved class is initialized (if not already) |
|
1353 | 235 |
Hides implementation details of the way of dealing with invalidation etc. User should not need to call anything |
236 |
else." |
|
237 |
||
238 |
self isResolved ifFalse: [ self findResolvedValue: doClassInit ]. |
|
239 |
^ valueCache. |
|
240 |
||
241 |
"Created: / 08-04-2011 / 11:30:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
242 |
"Created: / 09-02-2012 / 23:08:15 / mh <hlopik@gmail.com>" |
|
1391 | 243 |
"Modified (comment): / 28-02-2012 / 22:12:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1353 | 244 |
! |
245 |
||
774 | 246 |
updateClassRefsFrom: oldOwner to: newOwner |
840
8d04bfac22da
removed annoying updating classRefs from to output
hlopkmar
parents:
814
diff
changeset
|
247 |
self owner = oldOwner ifTrue: [ |
8d04bfac22da
removed annoying updating classRefs from to output
hlopkmar
parents:
814
diff
changeset
|
248 |
self owner: newOwner. |
8d04bfac22da
removed annoying updating classRefs from to output
hlopkmar
parents:
814
diff
changeset
|
249 |
]. |
774 | 250 |
|
251 |
"Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
840
8d04bfac22da
removed annoying updating classRefs from to output
hlopkmar
parents:
814
diff
changeset
|
252 |
"Modified: / 04-06-2011 / 17:54:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 253 |
! ! |
254 |
||
809 | 255 |
!JavaRef2 methodsFor:'testing'! |
256 |
||
257 |
isUnresolved |
|
258 |
||
259 |
^valueCache isNil |
|
260 |
||
261 |
"Created: / 22-05-2011 / 14:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
262 |
! ! |
|
263 |
||
752 | 264 |
!JavaRef2 class methodsFor:'documentation'! |
265 |
||
266 |
version_SVN |
|
267 |
^ '$Id$' |
|
268 |
! ! |