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