749
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
3 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
4 |
SWING Research Group, Czech Technical University in Prague
|
|
5 |
|
|
6 |
Parts of the code written by Claus Gittinger are under following
|
|
7 |
license:
|
|
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 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
|
|
17 |
|
|
18 |
Permission is hereby granted, free of charge, to any person
|
|
19 |
obtaining a copy of this software and associated documentation
|
|
20 |
files (the 'Software'), to deal in the Software without
|
|
21 |
restriction, including without limitation the rights to use,
|
|
22 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23 |
copies of the Software, and to permit persons to whom the
|
|
24 |
Software is furnished to do so, subject to the following
|
|
25 |
conditions:
|
|
26 |
|
|
27 |
The above copyright notice and this permission notice shall be
|
|
28 |
included in all copies or substantial portions of the Software.
|
|
29 |
|
|
30 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
31 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
32 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
33 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
34 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
35 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
36 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
37 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
38 |
|
|
39 |
[1] Code written at SWING Research Group contain a signature
|
|
40 |
of one of the above copright owners.
|
|
41 |
"
|
|
42 |
"{ Package: 'stx:libjava' }"
|
|
43 |
|
|
44 |
AbstractJavaTestCase subclass:#JavaMethodRefTests
|
|
45 |
instanceVariableNames:''
|
|
46 |
classVariableNames:''
|
|
47 |
poolDictionaries:''
|
|
48 |
category:'Languages-Java-Tests-RuntimeConstantPool'
|
|
49 |
!
|
|
50 |
|
|
51 |
!JavaMethodRefTests class methodsFor:'documentation'!
|
|
52 |
|
|
53 |
copyright
|
|
54 |
"
|
|
55 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
56 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
57 |
SWING Research Group, Czech Technical University in Prague
|
|
58 |
|
|
59 |
Parts of the code written by Claus Gittinger are under following
|
|
60 |
license:
|
|
61 |
|
|
62 |
This software is furnished under a license and may be used
|
|
63 |
only in accordance with the terms of that license and with the
|
|
64 |
inclusion of the above copyright notice. This software may not
|
|
65 |
be provided or otherwise made available to, or used by, any
|
|
66 |
other person. No title to or ownership of the software is
|
|
67 |
hereby transferred.
|
|
68 |
|
|
69 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
|
|
70 |
|
|
71 |
Permission is hereby granted, free of charge, to any person
|
|
72 |
obtaining a copy of this software and associated documentation
|
|
73 |
files (the 'Software'), to deal in the Software without
|
|
74 |
restriction, including without limitation the rights to use,
|
|
75 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
76 |
copies of the Software, and to permit persons to whom the
|
|
77 |
Software is furnished to do so, subject to the following
|
|
78 |
conditions:
|
|
79 |
|
|
80 |
The above copyright notice and this permission notice shall be
|
|
81 |
included in all copies or substantial portions of the Software.
|
|
82 |
|
|
83 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
84 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
85 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
86 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
87 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
88 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
89 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
90 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
91 |
|
|
92 |
[1] Code written at SWING Research Group contain a signature
|
|
93 |
of one of the above copright owners.
|
|
94 |
|
|
95 |
"
|
|
96 |
! !
|
|
97 |
|
|
98 |
!JavaMethodRefTests methodsFor:'permission tests'!
|
|
99 |
|
|
100 |
testAccessingPPFromOutside
|
|
101 |
| javaMethodRef initString |
|
|
102 |
|
|
103 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
|
|
104 |
self
|
|
105 |
should:
|
|
106 |
[ javaMethodRef := self
|
|
107 |
getMethodRefNamed: 'packagePrivateMethod'
|
|
108 |
typed: '()Ljava/lang/String;'
|
|
109 |
inClass: initString.
|
|
110 |
|
|
111 |
javaMethodRef resolve. ]
|
|
112 |
raise: Error
|
|
113 |
suchThat: [:e | e messageText = 'IllegalAccessError' ].
|
|
114 |
|
|
115 |
"Created: / 14-04-2011 / 15:10:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
116 |
"Modified: / 23-05-2011 / 17:15:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
117 |
!
|
|
118 |
|
|
119 |
testAccessingPPFromSubclass
|
|
120 |
| javaMethodRef initString |
|
|
121 |
|
|
122 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
|
|
123 |
self
|
|
124 |
shouldnt:
|
|
125 |
[ javaMethodRef := self
|
|
126 |
getMethodRefNamed: 'packagePrivateMethod'
|
|
127 |
typed: '()Ljava/lang/String;'
|
|
128 |
inClass: initString.
|
|
129 |
javaMethodRef
|
|
130 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
|
|
131 |
javaMethodRef resolve. ]
|
|
132 |
raise: Error
|
|
133 |
.
|
|
134 |
|
|
135 |
"Created: / 14-04-2011 / 15:10:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
136 |
"Modified: / 23-05-2011 / 17:14:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
137 |
!
|
|
138 |
|
|
139 |
testAccessingPrivateFromOutside
|
|
140 |
| javaMethodRef initString |
|
|
141 |
|
|
142 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
|
|
143 |
self
|
|
144 |
should:
|
|
145 |
[ javaMethodRef := self
|
|
146 |
getMethodRefNamed: 'privateMethod'
|
|
147 |
typed: '()Ljava/lang/String;'
|
|
148 |
inClass: initString.
|
|
149 |
javaMethodRef resolve. ]
|
|
150 |
raise: Error
|
|
151 |
suchThat: [:e | e messageText = 'IllegalAccessError' ].
|
|
152 |
|
|
153 |
"Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
154 |
"Modified: / 23-05-2011 / 17:16:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
155 |
!
|
|
156 |
|
|
157 |
testAccessingPrivateFromOutsideInNonPublic
|
|
158 |
| javaMethodRef initString |
|
|
159 |
|
|
160 |
initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
|
|
161 |
self
|
|
162 |
should:
|
|
163 |
[ javaMethodRef := self
|
|
164 |
getMethodRefNamed: 'privateMethod'
|
|
165 |
typed: '()Ljava/lang/String;'
|
|
166 |
inClass: initString.
|
|
167 |
javaMethodRef resolve. ]
|
|
168 |
raise: Error
|
|
169 |
suchThat: [:e | e messageText = 'IllegalAccessError' ].
|
|
170 |
|
|
171 |
"Created: / 13-04-2011 / 14:47:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
172 |
"Modified: / 23-05-2011 / 17:17:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
173 |
!
|
|
174 |
|
|
175 |
testAccessingPrivateFromSubclass
|
|
176 |
| javaMethodRef initString |
|
|
177 |
|
|
178 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
|
|
179 |
self
|
|
180 |
should:
|
|
181 |
[ javaMethodRef := self
|
|
182 |
getMethodRefNamed: 'privateMethod'
|
|
183 |
typed: '()Ljava/lang/String;'
|
|
184 |
inClass: initString.
|
|
185 |
javaMethodRef owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
|
|
186 |
javaMethodRef resolve. ]
|
|
187 |
raise: Error
|
|
188 |
suchThat: [:e | e messageText = 'IllegalAccessError' ].
|
|
189 |
|
|
190 |
"Created: / 13-04-2011 / 14:49:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
191 |
"Modified: / 23-05-2011 / 17:13:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
192 |
!
|
|
193 |
|
|
194 |
testAccessingProtectedFromOutside
|
|
195 |
| javaMethodRef initString |
|
|
196 |
|
|
197 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
|
|
198 |
self
|
|
199 |
should:
|
|
200 |
[ javaMethodRef := self
|
|
201 |
getMethodRefNamed: 'protectedMethod'
|
|
202 |
typed: '()Ljava/lang/String;'
|
|
203 |
inClass: initString.
|
|
204 |
javaMethodRef resolve. ]
|
|
205 |
raise: Error
|
|
206 |
suchThat: [:e | e messageText = 'IllegalAccessError' ].
|
|
207 |
|
|
208 |
"Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
209 |
"Modified: / 23-05-2011 / 17:12:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
210 |
!
|
|
211 |
|
|
212 |
testAccessingProtectedFromOutsideInNonPublic
|
|
213 |
| javaMethodRef initString |
|
|
214 |
|
|
215 |
initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
|
|
216 |
self
|
|
217 |
should:
|
|
218 |
[ javaMethodRef := self
|
|
219 |
getMethodRefNamed: 'protectedMethod'
|
|
220 |
typed: '()Ljava/lang/String;'
|
|
221 |
inClass: initString.
|
|
222 |
|
|
223 |
javaMethodRef resolve. ]
|
|
224 |
raise: Error
|
|
225 |
suchThat: [:e | e messageText = 'IllegalAccessError' ].
|
|
226 |
|
|
227 |
"Created: / 13-04-2011 / 14:47:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
228 |
"Modified: / 23-05-2011 / 17:12:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
229 |
!
|
|
230 |
|
|
231 |
testAccessingProtectedFromPackage
|
|
232 |
| javaMethodRef initString |
|
|
233 |
|
|
234 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
|
|
235 |
self shouldnt:
|
|
236 |
[ javaMethodRef := self
|
|
237 |
getMethodRefNamed: 'publicMethod'
|
|
238 |
typed: '()Ljava/lang/String;'
|
|
239 |
inClass: initString.
|
|
240 |
javaMethodRef
|
|
241 |
owner: (Java classForName: 'stx.libjava.tests.mocks.Crate').
|
|
242 |
javaMethodRef resolve. ]
|
|
243 |
raise: Error.
|
|
244 |
|
|
245 |
"Created: / 14-04-2011 / 15:09:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
246 |
"Modified: / 23-05-2011 / 17:11:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
247 |
!
|
|
248 |
|
|
249 |
testAccessingProtectedFromSubclass
|
|
250 |
| javaMethodRef initString |
|
|
251 |
|
|
252 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
|
|
253 |
self shouldnt:
|
|
254 |
[ javaMethodRef := self
|
|
255 |
getMethodRefNamed: 'protectedMethod'
|
|
256 |
typed: '()Ljava/lang/String;'
|
|
257 |
inClass: initString.
|
|
258 |
javaMethodRef
|
|
259 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
|
|
260 |
javaMethodRef resolve. ]
|
|
261 |
raise: Error.
|
|
262 |
|
|
263 |
"Created: / 13-04-2011 / 14:49:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
264 |
"Modified: / 23-05-2011 / 17:11:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
265 |
!
|
|
266 |
|
|
267 |
testAccessingPublicFromOutside
|
|
268 |
| javaMethodRef initString |
|
|
269 |
|
|
270 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
|
|
271 |
self shouldnt:
|
|
272 |
[ javaMethodRef := self
|
|
273 |
getMethodRefNamed: 'publicMethod'
|
|
274 |
typed: '()Ljava/lang/String;'
|
|
275 |
inClass: initString.
|
|
276 |
javaMethodRef
|
|
277 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
|
|
278 |
javaMethodRef resolve. ]
|
|
279 |
raise: Error.
|
|
280 |
|
|
281 |
"Created: / 13-04-2011 / 14:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
282 |
"Modified: / 23-05-2011 / 17:10:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
283 |
!
|
|
284 |
|
|
285 |
testAccessingPublicFromOutsideInNonPublic
|
|
286 |
| javaMethodRef initString |
|
|
287 |
|
|
288 |
initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
|
|
289 |
self shouldnt:
|
|
290 |
[ javaMethodRef := self
|
|
291 |
getMethodRefNamed: 'publicMethod'
|
|
292 |
typed: '()Ljava/lang/String;'
|
|
293 |
inClass: initString.
|
|
294 |
javaMethodRef
|
|
295 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
|
|
296 |
javaMethodRef resolve. ]
|
|
297 |
raise: Error.
|
|
298 |
|
|
299 |
"Created: / 13-04-2011 / 14:48:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
300 |
"Modified: / 23-05-2011 / 17:10:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
301 |
!
|
|
302 |
|
|
303 |
testAccessingPublicFromSubclass
|
|
304 |
| javaMethodRef initString |
|
|
305 |
|
|
306 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
|
|
307 |
self shouldnt:
|
|
308 |
[ javaMethodRef := self
|
|
309 |
getMethodRefNamed: 'publicMethod'
|
|
310 |
typed: '()Ljava/lang/String;'
|
|
311 |
inClass: initString.
|
|
312 |
javaMethodRef
|
|
313 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
|
|
314 |
javaMethodRef resolve. ]
|
|
315 |
raise: Error.
|
|
316 |
|
|
317 |
"Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
318 |
"Modified: / 23-05-2011 / 17:10:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
319 |
!
|
|
320 |
|
|
321 |
testAccessingPublicInterfaceFromOutside
|
|
322 |
| javaMethodRef initString |
|
|
323 |
|
|
324 |
initString := 'Lstx/libjava/tests/mocks/PublicInterface;'.
|
|
325 |
self should:
|
|
326 |
[ javaMethodRef := self
|
|
327 |
getMethodRefNamed: 'publicMethod'
|
|
328 |
typed: '()Ljava/lang/String;'
|
|
329 |
inClass: initString.
|
|
330 |
javaMethodRef
|
|
331 |
owner: (Java classForName: 'stx.libjava.tests.mocks.PublicClass').
|
|
332 |
javaMethodRef resolve. ]
|
|
333 |
raise: Error suchThat: [:e | e messageText = 'IncompatibleClassChangeError'].
|
|
334 |
|
|
335 |
"Created: / 23-05-2011 / 17:54:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
336 |
! !
|
|
337 |
|
|
338 |
!JavaMethodRefTests methodsFor:'resolving static tests'!
|
|
339 |
|
|
340 |
testCorrectStaticResolving
|
|
341 |
| initString javaMethodRef expectedResult result |
|
|
342 |
|
|
343 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
|
|
344 |
|
|
345 |
javaMethodRef := self
|
|
346 |
getMethodRefNamed: 'publicStaticMethod'
|
|
347 |
typed: '()Ljava/lang/String;'
|
|
348 |
inClass: initString.
|
|
349 |
|
|
350 |
result := javaMethodRef resolveStatic.
|
|
351 |
expectedResult := (Java
|
|
352 |
classForName: 'stx.libjava.tests.mocks.PublicClass') methodDictionary
|
|
353 |
at: #'publicStaticMethod()Ljava/lang/String;'.
|
|
354 |
self assertTrue: (result = expectedResult).
|
|
355 |
|
|
356 |
"Created: / 28-04-2011 / 22:46:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
357 |
"Modified: / 23-05-2011 / 17:08:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
358 |
! !
|
|
359 |
|
|
360 |
!JavaMethodRefTests methodsFor:'resolving tests'!
|
|
361 |
|
|
362 |
testCorrectInstanceCreation
|
|
363 |
| initString javaMethodRef |
|
|
364 |
|
|
365 |
initString := 'Ljava/lang/String;'.
|
|
366 |
javaMethodRef := self getMethodRefNamed: '<init>' typed: '()V' inClass: initString.
|
|
367 |
|
|
368 |
self assertTrue: (javaMethodRef isResolved not).
|
|
369 |
self assertTrue: (javaMethodRef valueCache isNil).
|
|
370 |
self assertTrue: (javaMethodRef name = '<init>').
|
|
371 |
self assertTrue: (javaMethodRef descriptor = '()V').
|
|
372 |
self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/String;').
|
|
373 |
|
|
374 |
"Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
375 |
"Modified: / 23-05-2011 / 17:03:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
376 |
!
|
|
377 |
|
|
378 |
testCorrectResolving
|
|
379 |
| initString javaMethodRef expectedResult result |
|
|
380 |
|
|
381 |
initString := 'Ljava/lang/String;'.
|
|
382 |
javaMethodRef := self
|
|
383 |
getMethodRefNamed: '<init>'
|
|
384 |
typed: '()V'
|
|
385 |
inClass: initString.
|
|
386 |
|
|
387 |
result := javaMethodRef resolve.
|
|
388 |
expectedResult := (Java classForName: 'java.lang.String') methodDictionary
|
|
389 |
at: #'<init>()V'.
|
|
390 |
self assertTrue: (result = expectedResult).
|
|
391 |
|
|
392 |
"Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
393 |
"Modified: / 23-05-2011 / 17:06:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
394 |
!
|
|
395 |
|
|
396 |
testInvalidation
|
|
397 |
| javaMethodRef initString|
|
|
398 |
|
|
399 |
initString := 'Ljava/lang/String;'.
|
|
400 |
javaMethodRef := self
|
|
401 |
getMethodRefNamed: '<init>'
|
|
402 |
typed: '()V'
|
|
403 |
inClass: initString.
|
|
404 |
self assertTrue: (javaMethodRef isResolved not).
|
|
405 |
javaMethodRef resolve.
|
|
406 |
self assertTrue: (javaMethodRef isResolved).
|
|
407 |
self assertTrue: (javaMethodRef classRef isResolved).
|
|
408 |
javaMethodRef invalidate.
|
|
409 |
self assertTrue: (javaMethodRef isResolved not).
|
|
410 |
self assertTrue: (javaMethodRef classRef isResolved not).
|
|
411 |
|
|
412 |
"Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
413 |
"Modified: / 23-05-2011 / 17:06:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
414 |
!
|
|
415 |
|
|
416 |
testInvalidationForClassNegative
|
|
417 |
| javaMethodRef initString|
|
|
418 |
|
|
419 |
initString := 'Ljava/lang/String;'.
|
|
420 |
|
|
421 |
javaMethodRef := self
|
|
422 |
getMethodRefNamed: '<init>'
|
|
423 |
typed: '()V'
|
|
424 |
inClass: initString.
|
|
425 |
self assertTrue: (javaMethodRef isResolved not).
|
|
426 |
javaMethodRef resolve.
|
|
427 |
self assertTrue: (javaMethodRef isResolved).
|
|
428 |
javaMethodRef invalidateForClass: 'Ljava/lang/Object;'.
|
|
429 |
self assertTrue: (javaMethodRef isResolved).
|
|
430 |
|
|
431 |
"Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
432 |
"Modified: / 23-05-2011 / 17:07:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
433 |
!
|
|
434 |
|
|
435 |
testInvalidationForClassPositive
|
|
436 |
| javaMethodRef initString|
|
|
437 |
|
|
438 |
initString := 'Ljava/lang/String;'.
|
|
439 |
javaMethodRef := self
|
|
440 |
getMethodRefNamed: '<init>'
|
|
441 |
typed: '()V'
|
|
442 |
inClass: initString.
|
|
443 |
self assertTrue: (javaMethodRef isResolved not).
|
|
444 |
javaMethodRef resolve.
|
|
445 |
self assertTrue: (javaMethodRef isResolved).
|
|
446 |
javaMethodRef invalidateForClass: 'Ljava/lang/String;'.
|
|
447 |
self assertTrue: (javaMethodRef isResolved not).
|
|
448 |
|
|
449 |
"Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
450 |
"Modified: / 23-05-2011 / 17:07:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
451 |
!
|
|
452 |
|
|
453 |
testResolving
|
|
454 |
| initString javaMethodRef |
|
|
455 |
|
|
456 |
initString := 'Ljava/lang/String;'.
|
|
457 |
javaMethodRef := self
|
|
458 |
getMethodRefNamed: '<init>'
|
|
459 |
typed: '()V'
|
|
460 |
inClass: initString.
|
|
461 |
|
|
462 |
self assertTrue: (javaMethodRef isResolved not).
|
|
463 |
javaMethodRef resolve.
|
|
464 |
self assertTrue: (javaMethodRef classRef isResolved).
|
|
465 |
self assertTrue: (javaMethodRef isResolved).
|
|
466 |
|
|
467 |
"Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
468 |
"Modified: / 23-05-2011 / 17:05:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
469 |
! !
|
|
470 |
|
|
471 |
!JavaMethodRefTests class methodsFor:'documentation'!
|
|
472 |
|
|
473 |
version_SVN
|
2152
|
474 |
^ '$Id: JavaMethodRefTests.st,v 1.1 2011-08-18 19:06:53 vrany Exp $'
|
|
475 |
! !
|