author | mawalch |
Thu, 08 Jun 2017 14:04:24 +0200 | |
branch | cvs_MAIN |
changeset 3724 | 8184529b4866 |
parent 3412 | df11bb428463 |
permissions | -rw-r--r-- |
749 | 1 |
" |
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2992
diff
changeset
|
2 |
COPYRIGHT (c) 1996-2015 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 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2992
diff
changeset
|
6 |
COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko |
749 | 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 |
||
3330
b14c58b2876c
Oops, moved stray reloading-related methods from stx:libjava/experiments to stx:libjava.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
23 |
"{ NameSpace: Smalltalk }" |
b14c58b2876c
Oops, moved stray reloading-related methods from stx:libjava/experiments to stx:libjava.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
24 |
|
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
|
25 |
JavaRefsAndConstantPoolTestCase subclass:#JavaMethodRefTests |
749 | 26 |
instanceVariableNames:'' |
27 |
classVariableNames:'' |
|
28 |
poolDictionaries:'' |
|
29 |
category:'Languages-Java-Tests-RuntimeConstantPool' |
|
30 |
! |
|
31 |
||
32 |
!JavaMethodRefTests class methodsFor:'documentation'! |
|
33 |
||
34 |
copyright |
|
35 |
" |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2992
diff
changeset
|
36 |
COPYRIGHT (c) 1996-2015 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
|
37 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
38 |
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
|
39 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2992
diff
changeset
|
40 |
COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko |
749 | 41 |
SWING Research Group, Czech Technical University in Prague |
42 |
||
43 |
This software is furnished under a license and may be used |
|
44 |
only in accordance with the terms of that license and with the |
|
45 |
inclusion of the above copyright notice. This software may not |
|
46 |
be provided or otherwise made available to, or used by, any |
|
47 |
other person. No title to or ownership of the software is |
|
48 |
hereby transferred. |
|
49 |
||
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
|
50 |
[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
|
51 |
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
|
52 |
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
|
53 |
as of 1.9.2010 |
749 | 54 |
|
55 |
" |
|
56 |
! ! |
|
57 |
||
58 |
!JavaMethodRefTests methodsFor:'permission tests'! |
|
59 |
||
60 |
testAccessingPPFromOutside |
|
61 |
| javaMethodRef initString | |
|
62 |
||
63 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
64 |
self |
|
65 |
should: |
|
66 |
[ javaMethodRef := self |
|
67 |
getMethodRefNamed: 'packagePrivateMethod' |
|
68 |
typed: '()Ljava/lang/String;' |
|
69 |
inClass: initString. |
|
70 |
||
71 |
javaMethodRef resolve. ] |
|
72 |
raise: Error |
|
73 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
74 |
||
75 |
"Created: / 14-04-2011 / 15:10:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
76 |
"Modified: / 23-05-2011 / 17:15:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
77 |
! |
|
78 |
||
79 |
testAccessingPPFromSubclass |
|
80 |
| javaMethodRef initString | |
|
81 |
||
82 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
83 |
self |
|
84 |
shouldnt: |
|
85 |
[ javaMethodRef := self |
|
86 |
getMethodRefNamed: 'packagePrivateMethod' |
|
87 |
typed: '()Ljava/lang/String;' |
|
88 |
inClass: initString. |
|
89 |
javaMethodRef |
|
90 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
91 |
javaMethodRef resolve. ] |
|
92 |
raise: Error |
|
93 |
. |
|
94 |
||
95 |
"Created: / 14-04-2011 / 15:10:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
96 |
"Modified: / 23-05-2011 / 17:14:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
97 |
! |
|
98 |
||
99 |
testAccessingPrivateFromOutside |
|
100 |
| javaMethodRef initString | |
|
101 |
||
102 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
103 |
self |
|
104 |
should: |
|
105 |
[ javaMethodRef := self |
|
106 |
getMethodRefNamed: 'privateMethod' |
|
107 |
typed: '()Ljava/lang/String;' |
|
108 |
inClass: initString. |
|
109 |
javaMethodRef resolve. ] |
|
110 |
raise: Error |
|
111 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
112 |
||
113 |
"Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
114 |
"Modified: / 23-05-2011 / 17:16:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
115 |
! |
|
116 |
||
117 |
testAccessingPrivateFromOutsideInNonPublic |
|
118 |
| javaMethodRef initString | |
|
119 |
||
120 |
initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'. |
|
121 |
self |
|
122 |
should: |
|
123 |
[ javaMethodRef := self |
|
124 |
getMethodRefNamed: 'privateMethod' |
|
125 |
typed: '()Ljava/lang/String;' |
|
126 |
inClass: initString. |
|
127 |
javaMethodRef resolve. ] |
|
128 |
raise: Error |
|
129 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
130 |
||
131 |
"Created: / 13-04-2011 / 14:47:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
132 |
"Modified: / 23-05-2011 / 17:17:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
133 |
! |
|
134 |
||
135 |
testAccessingPrivateFromSubclass |
|
136 |
| javaMethodRef initString | |
|
137 |
||
138 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
139 |
self |
|
140 |
should: |
|
141 |
[ javaMethodRef := self |
|
142 |
getMethodRefNamed: 'privateMethod' |
|
143 |
typed: '()Ljava/lang/String;' |
|
144 |
inClass: initString. |
|
145 |
javaMethodRef owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
146 |
javaMethodRef resolve. ] |
|
147 |
raise: Error |
|
148 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
149 |
||
150 |
"Created: / 13-04-2011 / 14:49:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
151 |
"Modified: / 23-05-2011 / 17:13:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
152 |
! |
|
153 |
||
154 |
testAccessingProtectedFromOutside |
|
155 |
| javaMethodRef initString | |
|
156 |
||
157 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
158 |
self |
|
159 |
should: |
|
160 |
[ javaMethodRef := self |
|
161 |
getMethodRefNamed: 'protectedMethod' |
|
162 |
typed: '()Ljava/lang/String;' |
|
163 |
inClass: initString. |
|
164 |
javaMethodRef resolve. ] |
|
165 |
raise: Error |
|
166 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
167 |
||
168 |
"Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
169 |
"Modified: / 23-05-2011 / 17:12:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
170 |
! |
|
171 |
||
172 |
testAccessingProtectedFromOutsideInNonPublic |
|
173 |
| javaMethodRef initString | |
|
174 |
||
175 |
initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'. |
|
176 |
self |
|
177 |
should: |
|
178 |
[ javaMethodRef := self |
|
179 |
getMethodRefNamed: 'protectedMethod' |
|
180 |
typed: '()Ljava/lang/String;' |
|
181 |
inClass: initString. |
|
182 |
||
183 |
javaMethodRef resolve. ] |
|
184 |
raise: Error |
|
185 |
suchThat: [:e | e messageText = 'IllegalAccessError' ]. |
|
186 |
||
187 |
"Created: / 13-04-2011 / 14:47:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
188 |
"Modified: / 23-05-2011 / 17:12:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
189 |
! |
|
190 |
||
191 |
testAccessingProtectedFromPackage |
|
192 |
| javaMethodRef initString | |
|
193 |
||
194 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
195 |
self shouldnt: |
|
196 |
[ javaMethodRef := self |
|
197 |
getMethodRefNamed: 'publicMethod' |
|
198 |
typed: '()Ljava/lang/String;' |
|
199 |
inClass: initString. |
|
200 |
javaMethodRef |
|
201 |
owner: (Java classForName: 'stx.libjava.tests.mocks.Crate'). |
|
202 |
javaMethodRef resolve. ] |
|
203 |
raise: Error. |
|
204 |
||
205 |
"Created: / 14-04-2011 / 15:09:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
206 |
"Modified: / 23-05-2011 / 17:11:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
207 |
! |
|
208 |
||
209 |
testAccessingProtectedFromSubclass |
|
210 |
| javaMethodRef initString | |
|
211 |
||
212 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
213 |
self shouldnt: |
|
214 |
[ javaMethodRef := self |
|
215 |
getMethodRefNamed: 'protectedMethod' |
|
216 |
typed: '()Ljava/lang/String;' |
|
217 |
inClass: initString. |
|
218 |
javaMethodRef |
|
219 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
220 |
javaMethodRef resolve. ] |
|
221 |
raise: Error. |
|
222 |
||
223 |
"Created: / 13-04-2011 / 14:49:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
224 |
"Modified: / 23-05-2011 / 17:11:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
225 |
! |
|
226 |
||
227 |
testAccessingPublicFromOutside |
|
228 |
| javaMethodRef initString | |
|
229 |
||
230 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
231 |
self shouldnt: |
|
232 |
[ javaMethodRef := self |
|
233 |
getMethodRefNamed: 'publicMethod' |
|
234 |
typed: '()Ljava/lang/String;' |
|
235 |
inClass: initString. |
|
236 |
javaMethodRef |
|
237 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
238 |
javaMethodRef resolve. ] |
|
239 |
raise: Error. |
|
240 |
||
241 |
"Created: / 13-04-2011 / 14:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
242 |
"Modified: / 23-05-2011 / 17:10:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
243 |
! |
|
244 |
||
245 |
testAccessingPublicFromOutsideInNonPublic |
|
246 |
| javaMethodRef initString | |
|
247 |
||
248 |
initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'. |
|
249 |
self shouldnt: |
|
250 |
[ javaMethodRef := self |
|
251 |
getMethodRefNamed: 'publicMethod' |
|
252 |
typed: '()Ljava/lang/String;' |
|
253 |
inClass: initString. |
|
254 |
javaMethodRef |
|
255 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
256 |
javaMethodRef resolve. ] |
|
257 |
raise: Error. |
|
258 |
||
259 |
"Created: / 13-04-2011 / 14:48:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
260 |
"Modified: / 23-05-2011 / 17:10:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
261 |
! |
|
262 |
||
263 |
testAccessingPublicFromSubclass |
|
264 |
| javaMethodRef initString | |
|
265 |
||
266 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
267 |
self shouldnt: |
|
268 |
[ javaMethodRef := self |
|
269 |
getMethodRefNamed: 'publicMethod' |
|
270 |
typed: '()Ljava/lang/String;' |
|
271 |
inClass: initString. |
|
272 |
javaMethodRef |
|
273 |
owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass'). |
|
274 |
javaMethodRef resolve. ] |
|
275 |
raise: Error. |
|
276 |
||
277 |
"Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
278 |
"Modified: / 23-05-2011 / 17:10:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
279 |
! |
|
280 |
||
281 |
testAccessingPublicInterfaceFromOutside |
|
282 |
| javaMethodRef initString | |
|
283 |
||
284 |
initString := 'Lstx/libjava/tests/mocks/PublicInterface;'. |
|
285 |
self should: |
|
286 |
[ javaMethodRef := self |
|
287 |
getMethodRefNamed: 'publicMethod' |
|
288 |
typed: '()Ljava/lang/String;' |
|
289 |
inClass: initString. |
|
290 |
javaMethodRef |
|
291 |
owner: (Java classForName: 'stx.libjava.tests.mocks.PublicClass'). |
|
292 |
javaMethodRef resolve. ] |
|
293 |
raise: Error suchThat: [:e | e messageText = 'IncompatibleClassChangeError']. |
|
294 |
||
295 |
"Created: / 23-05-2011 / 17:54:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
296 |
! ! |
|
297 |
||
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 |
||
317 |
!JavaMethodRefTests methodsFor:'resolving tests'! |
|
318 |
||
319 |
testCorrectInstanceCreation |
|
320 |
| initString javaMethodRef | |
|
321 |
||
322 |
initString := 'Ljava/lang/String;'. |
|
323 |
javaMethodRef := self getMethodRefNamed: '<init>' typed: '()V' inClass: initString. |
|
324 |
||
325 |
self assertTrue: (javaMethodRef isResolved not). |
|
2992
732f9db2a195
Cleanup & refactoring of constant pool references (JavaRef2 hierarchy)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2731
diff
changeset
|
326 |
self assertTrue: (javaMethodRef resolvedValue isNil). |
749 | 327 |
self assertTrue: (javaMethodRef name = '<init>'). |
328 |
self assertTrue: (javaMethodRef descriptor = '()V'). |
|
329 |
self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/String;'). |
|
330 |
||
331 |
"Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
332 |
"Modified: / 23-05-2011 / 17:03:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2992
732f9db2a195
Cleanup & refactoring of constant pool references (JavaRef2 hierarchy)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2731
diff
changeset
|
333 |
"Modified: / 31-01-2014 / 09:08:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 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 |
||
429 |
!JavaMethodRefTests class methodsFor:'documentation'! |
|
430 |
||
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
|
431 |
version_CVS |
3412
df11bb428463
Merged with mercurial revision 4f3cc813be4 (8 changesets total)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3360
diff
changeset
|
432 |
^ '$Header: /cvs/stx/stx/libjava/JavaMethodRefTests.st,v 1.6 2015-03-20 12:08:00 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
|
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 |
|
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 |
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
|
436 |
|
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 |
^ '$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
|
438 |
! |
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 |
|
749 | 440 |
version_SVN |
2731
13f5be2bf83b
Merged d87e89dd5276 and fe83a843a7bf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
441 |
^ 'Id' |
2152 | 442 |
! ! |
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
|
443 |