author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 24 May 2013 17:55:42 +0100 | |
branch | builtin-class-support |
changeset 2629 | cedb88626902 |
parent 2578 | fc6186a4961f |
child 2711 | a00302fe5083 |
permissions | -rw-r--r-- |
749 | 1 |
" |
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:
2152
diff
changeset
|
3 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
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:
2152
diff
changeset
|
5 |
|
749 | 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 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
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:
2152
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:
2152
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:
2152
diff
changeset
|
19 |
as of 1.9.2010 |
749 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
23 |
JavaRefsAndConstantPoolTestCase subclass:#JavaMethodRefTests |
749 | 24 |
instanceVariableNames:'' |
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Tests-RuntimeConstantPool' |
|
28 |
! |
|
29 |
||
30 |
!JavaMethodRefTests class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
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:
2152
diff
changeset
|
35 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
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:
2152
diff
changeset
|
37 |
|
749 | 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 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
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:
2152
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:
2152
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:
2152
diff
changeset
|
51 |
as of 1.9.2010 |
749 | 52 |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
56 |
!JavaMethodRefTests methodsFor:'permission tests'! |
|
57 |
||
58 |
testAccessingPPFromOutside |
|
59 |
| javaMethodRef initString | |
|
60 |
||
61 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
62 |
self |
|
63 |
should: |
|
64 |
[ javaMethodRef := self |
|
65 |
getMethodRefNamed: 'packagePrivateMethod' |
|
66 |
typed: '()Ljava/lang/String;' |
|
67 |
inClass: initString. |
|
68 |
||
69 |
javaMethodRef resolve. ] |
|
70 |
raise: Error |
|
71 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
72 |
||
73 |
"Created: / 14-04-2011 / 15:10:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
74 |
"Modified: / 23-05-2011 / 17:15:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
75 |
! |
|
76 |
||
77 |
testAccessingPPFromSubclass |
|
78 |
| javaMethodRef initString | |
|
79 |
||
80 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
81 |
self |
|
82 |
shouldnt: |
|
83 |
[ javaMethodRef := self |
|
84 |
getMethodRefNamed: 'packagePrivateMethod' |
|
85 |
typed: '()Ljava/lang/String;' |
|
86 |
inClass: initString. |
|
87 |
javaMethodRef |
|
88 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
89 |
javaMethodRef resolve. ] |
|
90 |
raise: Error |
|
91 |
. |
|
92 |
||
93 |
"Created: / 14-04-2011 / 15:10:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
94 |
"Modified: / 23-05-2011 / 17:14:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
95 |
! |
|
96 |
||
97 |
testAccessingPrivateFromOutside |
|
98 |
| javaMethodRef initString | |
|
99 |
||
100 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
101 |
self |
|
102 |
should: |
|
103 |
[ javaMethodRef := self |
|
104 |
getMethodRefNamed: 'privateMethod' |
|
105 |
typed: '()Ljava/lang/String;' |
|
106 |
inClass: initString. |
|
107 |
javaMethodRef resolve. ] |
|
108 |
raise: Error |
|
109 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
110 |
||
111 |
"Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
112 |
"Modified: / 23-05-2011 / 17:16:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
113 |
! |
|
114 |
||
115 |
testAccessingPrivateFromOutsideInNonPublic |
|
116 |
| javaMethodRef initString | |
|
117 |
||
118 |
initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'. |
|
119 |
self |
|
120 |
should: |
|
121 |
[ javaMethodRef := self |
|
122 |
getMethodRefNamed: 'privateMethod' |
|
123 |
typed: '()Ljava/lang/String;' |
|
124 |
inClass: initString. |
|
125 |
javaMethodRef resolve. ] |
|
126 |
raise: Error |
|
127 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
128 |
||
129 |
"Created: / 13-04-2011 / 14:47:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
130 |
"Modified: / 23-05-2011 / 17:17:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
131 |
! |
|
132 |
||
133 |
testAccessingPrivateFromSubclass |
|
134 |
| javaMethodRef initString | |
|
135 |
||
136 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
137 |
self |
|
138 |
should: |
|
139 |
[ javaMethodRef := self |
|
140 |
getMethodRefNamed: 'privateMethod' |
|
141 |
typed: '()Ljava/lang/String;' |
|
142 |
inClass: initString. |
|
143 |
javaMethodRef owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
144 |
javaMethodRef resolve. ] |
|
145 |
raise: Error |
|
146 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
147 |
||
148 |
"Created: / 13-04-2011 / 14:49:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
149 |
"Modified: / 23-05-2011 / 17:13:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
150 |
! |
|
151 |
||
152 |
testAccessingProtectedFromOutside |
|
153 |
| javaMethodRef initString | |
|
154 |
||
155 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
156 |
self |
|
157 |
should: |
|
158 |
[ javaMethodRef := self |
|
159 |
getMethodRefNamed: 'protectedMethod' |
|
160 |
typed: '()Ljava/lang/String;' |
|
161 |
inClass: initString. |
|
162 |
javaMethodRef resolve. ] |
|
163 |
raise: Error |
|
164 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
165 |
||
166 |
"Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
167 |
"Modified: / 23-05-2011 / 17:12:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
168 |
! |
|
169 |
||
170 |
testAccessingProtectedFromOutsideInNonPublic |
|
171 |
| javaMethodRef initString | |
|
172 |
||
173 |
initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'. |
|
174 |
self |
|
175 |
should: |
|
176 |
[ javaMethodRef := self |
|
177 |
getMethodRefNamed: 'protectedMethod' |
|
178 |
typed: '()Ljava/lang/String;' |
|
179 |
inClass: initString. |
|
180 |
||
181 |
javaMethodRef resolve. ] |
|
182 |
raise: Error |
|
183 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
184 |
||
185 |
"Created: / 13-04-2011 / 14:47:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
186 |
"Modified: / 23-05-2011 / 17:12:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
187 |
! |
|
188 |
||
189 |
testAccessingProtectedFromPackage |
|
190 |
| javaMethodRef initString | |
|
191 |
||
192 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
193 |
self shouldnt: |
|
194 |
[ javaMethodRef := self |
|
195 |
getMethodRefNamed: 'publicMethod' |
|
196 |
typed: '()Ljava/lang/String;' |
|
197 |
inClass: initString. |
|
198 |
javaMethodRef |
|
199 |
owner: (Java classForName: 'stx.libjava.tests.mocks.Crate'). |
|
200 |
javaMethodRef resolve. ] |
|
201 |
raise: Error. |
|
202 |
||
203 |
"Created: / 14-04-2011 / 15:09:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
204 |
"Modified: / 23-05-2011 / 17:11:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
205 |
! |
|
206 |
||
207 |
testAccessingProtectedFromSubclass |
|
208 |
| javaMethodRef initString | |
|
209 |
||
210 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
211 |
self shouldnt: |
|
212 |
[ javaMethodRef := self |
|
213 |
getMethodRefNamed: 'protectedMethod' |
|
214 |
typed: '()Ljava/lang/String;' |
|
215 |
inClass: initString. |
|
216 |
javaMethodRef |
|
217 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
218 |
javaMethodRef resolve. ] |
|
219 |
raise: Error. |
|
220 |
||
221 |
"Created: / 13-04-2011 / 14:49:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
222 |
"Modified: / 23-05-2011 / 17:11:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
223 |
! |
|
224 |
||
225 |
testAccessingPublicFromOutside |
|
226 |
| javaMethodRef initString | |
|
227 |
||
228 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
229 |
self shouldnt: |
|
230 |
[ javaMethodRef := self |
|
231 |
getMethodRefNamed: 'publicMethod' |
|
232 |
typed: '()Ljava/lang/String;' |
|
233 |
inClass: initString. |
|
234 |
javaMethodRef |
|
235 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
236 |
javaMethodRef resolve. ] |
|
237 |
raise: Error. |
|
238 |
||
239 |
"Created: / 13-04-2011 / 14:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
240 |
"Modified: / 23-05-2011 / 17:10:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
241 |
! |
|
242 |
||
243 |
testAccessingPublicFromOutsideInNonPublic |
|
244 |
| javaMethodRef initString | |
|
245 |
||
246 |
initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'. |
|
247 |
self shouldnt: |
|
248 |
[ javaMethodRef := self |
|
249 |
getMethodRefNamed: 'publicMethod' |
|
250 |
typed: '()Ljava/lang/String;' |
|
251 |
inClass: initString. |
|
252 |
javaMethodRef |
|
253 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
254 |
javaMethodRef resolve. ] |
|
255 |
raise: Error. |
|
256 |
||
257 |
"Created: / 13-04-2011 / 14:48:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
258 |
"Modified: / 23-05-2011 / 17:10:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
259 |
! |
|
260 |
||
261 |
testAccessingPublicFromSubclass |
|
262 |
| javaMethodRef initString | |
|
263 |
||
264 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
265 |
self shouldnt: |
|
266 |
[ javaMethodRef := self |
|
267 |
getMethodRefNamed: 'publicMethod' |
|
268 |
typed: '()Ljava/lang/String;' |
|
269 |
inClass: initString. |
|
270 |
javaMethodRef |
|
271 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
272 |
javaMethodRef resolve. ] |
|
273 |
raise: Error. |
|
274 |
||
275 |
"Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
276 |
"Modified: / 23-05-2011 / 17:10:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
277 |
! |
|
278 |
||
279 |
testAccessingPublicInterfaceFromOutside |
|
280 |
| javaMethodRef initString | |
|
281 |
||
282 |
initString := 'Lstx/libjava/tests/mocks/PublicInterface;'. |
|
283 |
self should: |
|
284 |
[ javaMethodRef := self |
|
285 |
getMethodRefNamed: 'publicMethod' |
|
286 |
typed: '()Ljava/lang/String;' |
|
287 |
inClass: initString. |
|
288 |
javaMethodRef |
|
289 |
owner: (Java classForName: 'stx.libjava.tests.mocks.PublicClass'). |
|
290 |
javaMethodRef resolve. ] |
|
291 |
raise: Error suchThat: [:e | e messageText = 'IncompatibleClassChangeError']. |
|
292 |
||
293 |
"Created: / 23-05-2011 / 17:54:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
294 |
! ! |
|
295 |
||
296 |
!JavaMethodRefTests methodsFor:'resolving static tests'! |
|
297 |
||
298 |
testCorrectStaticResolving |
|
299 |
| initString javaMethodRef expectedResult result | |
|
300 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
301 |
javaMethodRef := self |
749 | 302 |
getMethodRefNamed: 'publicStaticMethod' |
303 |
typed: '()Ljava/lang/String;' |
|
304 |
inClass: initString. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
305 |
result := javaMethodRef resolve. |
749 | 306 |
expectedResult := (Java |
307 |
classForName: 'stx.libjava.tests.mocks.PublicClass') methodDictionary |
|
308 |
at: #'publicStaticMethod()Ljava/lang/String;'. |
|
309 |
self assertTrue: (result = expectedResult). |
|
310 |
||
311 |
"Created: / 28-04-2011 / 22:46:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
312 |
"Modified: / 08-12-2011 / 19:25:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
749 | 313 |
! ! |
314 |
||
315 |
!JavaMethodRefTests methodsFor:'resolving tests'! |
|
316 |
||
317 |
testCorrectInstanceCreation |
|
318 |
| initString javaMethodRef | |
|
319 |
||
320 |
initString := 'Ljava/lang/String;'. |
|
321 |
javaMethodRef := self getMethodRefNamed: '<init>' typed: '()V' inClass: initString. |
|
322 |
||
323 |
self assertTrue: (javaMethodRef isResolved not). |
|
324 |
self assertTrue: (javaMethodRef valueCache isNil). |
|
325 |
self assertTrue: (javaMethodRef name = '<init>'). |
|
326 |
self assertTrue: (javaMethodRef descriptor = '()V'). |
|
327 |
self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/String;'). |
|
328 |
||
329 |
"Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
330 |
"Modified: / 23-05-2011 / 17:03:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
331 |
! |
|
332 |
||
333 |
testCorrectResolving |
|
334 |
| initString javaMethodRef expectedResult result | |
|
335 |
||
336 |
initString := 'Ljava/lang/String;'. |
|
337 |
javaMethodRef := self |
|
338 |
getMethodRefNamed: '<init>' |
|
339 |
typed: '()V' |
|
340 |
inClass: initString. |
|
341 |
||
342 |
result := javaMethodRef resolve. |
|
343 |
expectedResult := (Java classForName: 'java.lang.String') methodDictionary |
|
344 |
at: #'<init>()V'. |
|
345 |
self assertTrue: (result = expectedResult). |
|
346 |
||
347 |
"Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
348 |
"Modified: / 23-05-2011 / 17:06:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
349 |
! |
|
350 |
||
351 |
testInvalidation |
|
352 |
| javaMethodRef initString| |
|
353 |
||
354 |
initString := 'Ljava/lang/String;'. |
|
355 |
javaMethodRef := self |
|
356 |
getMethodRefNamed: '<init>' |
|
357 |
typed: '()V' |
|
358 |
inClass: initString. |
|
359 |
self assertTrue: (javaMethodRef isResolved not). |
|
360 |
javaMethodRef resolve. |
|
361 |
self assertTrue: (javaMethodRef isResolved). |
|
362 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
363 |
javaMethodRef invalidate. |
|
364 |
self assertTrue: (javaMethodRef isResolved not). |
|
365 |
self assertTrue: (javaMethodRef classRef isResolved not). |
|
366 |
||
367 |
"Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
368 |
"Modified: / 23-05-2011 / 17:06:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
369 |
! |
|
370 |
||
371 |
testInvalidationForClassNegative |
|
372 |
| javaMethodRef initString| |
|
373 |
||
374 |
initString := 'Ljava/lang/String;'. |
|
375 |
||
376 |
javaMethodRef := self |
|
377 |
getMethodRefNamed: '<init>' |
|
378 |
typed: '()V' |
|
379 |
inClass: initString. |
|
380 |
self assertTrue: (javaMethodRef isResolved not). |
|
381 |
javaMethodRef resolve. |
|
382 |
self assertTrue: (javaMethodRef isResolved). |
|
383 |
javaMethodRef invalidateForClass: 'Ljava/lang/Object;'. |
|
384 |
self assertTrue: (javaMethodRef isResolved). |
|
385 |
||
386 |
"Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
387 |
"Modified: / 23-05-2011 / 17:07:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
388 |
! |
|
389 |
||
390 |
testInvalidationForClassPositive |
|
391 |
| javaMethodRef initString| |
|
392 |
||
393 |
initString := 'Ljava/lang/String;'. |
|
394 |
javaMethodRef := self |
|
395 |
getMethodRefNamed: '<init>' |
|
396 |
typed: '()V' |
|
397 |
inClass: initString. |
|
398 |
self assertTrue: (javaMethodRef isResolved not). |
|
399 |
javaMethodRef resolve. |
|
400 |
self assertTrue: (javaMethodRef isResolved). |
|
401 |
javaMethodRef invalidateForClass: 'Ljava/lang/String;'. |
|
402 |
self assertTrue: (javaMethodRef isResolved not). |
|
403 |
||
404 |
"Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
405 |
"Modified: / 23-05-2011 / 17:07:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
406 |
! |
|
407 |
||
408 |
testResolving |
|
409 |
| initString javaMethodRef | |
|
410 |
||
411 |
initString := 'Ljava/lang/String;'. |
|
412 |
javaMethodRef := self |
|
413 |
getMethodRefNamed: '<init>' |
|
414 |
typed: '()V' |
|
415 |
inClass: initString. |
|
416 |
||
417 |
self assertTrue: (javaMethodRef isResolved not). |
|
418 |
javaMethodRef resolve. |
|
419 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
420 |
self assertTrue: (javaMethodRef isResolved). |
|
421 |
||
422 |
"Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
423 |
"Modified: / 23-05-2011 / 17:05:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
424 |
! ! |
|
425 |
||
426 |
!JavaMethodRefTests class methodsFor:'documentation'! |
|
427 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
428 |
version_CVS |
2578
fc6186a4961f
Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2429
diff
changeset
|
429 |
^ '$Header: /cvs/stx/stx/libjava/JavaMethodRefTests.st,v 1.3 2013/02/25 11:15:31 vrany Exp $' |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
430 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
431 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
432 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
433 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
434 |
^ '$Changeset: <not expanded> $' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
435 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
436 |
|
749 | 437 |
version_SVN |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
438 |
^ '§Id§' |
2152 | 439 |
! ! |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
440 |