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