author | vranyj1 |
Tue, 26 Jul 2011 16:31:02 +0000 | |
branch | jk_new_structure |
changeset 877 | f5a5b93e1c78 |
parent 816 | 4e3072021201 |
child 1152 | 040cba55a7d2 |
permissions | -rw-r--r-- |
877 | 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 |
" |
|
758 | 42 |
"{ Package: 'stx:libjava' }" |
43 |
||
773 | 44 |
AbstractJavaTestCase subclass:#JavaInterfaceMethodRefTests |
758 | 45 |
instanceVariableNames:'' |
46 |
classVariableNames:'' |
|
47 |
poolDictionaries:'' |
|
48 |
category:'Languages-Java-Tests-RuntimeConstantPool' |
|
49 |
! |
|
50 |
||
877 | 51 |
!JavaInterfaceMethodRefTests 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 |
! ! |
|
758 | 97 |
|
98 |
!JavaInterfaceMethodRefTests methodsFor:'javaInterfaceMethodRef tests'! |
|
99 |
||
100 |
testCorrectInstanceCreation |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
101 |
| initString javaMethodRef | |
758 | 102 |
|
103 |
initString := 'Ljava/lang/Runnable;'. |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
104 |
javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
105 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
106 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
107 |
inClass: initString. |
758 | 108 |
self assertTrue: (javaMethodRef isResolved not). |
109 |
self assertTrue: (javaMethodRef valueCache isNil). |
|
110 |
self assertTrue: (javaMethodRef name = 'run'). |
|
111 |
self assertTrue: (javaMethodRef descriptor = '()V'). |
|
112 |
self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/Runnable;'). |
|
113 |
||
114 |
"Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
115 |
"Modified: / 23-05-2011 / 17:19:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 116 |
! |
117 |
||
118 |
testCorrectResolving |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
119 |
| initString javaMethodRef expectedResult result | |
758 | 120 |
|
121 |
initString := 'Ljava/lang/Runnable;'. |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
122 |
javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
123 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
124 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
125 |
inClass: initString. |
758 | 126 |
result := javaMethodRef resolve. |
761 | 127 |
expectedResult := (Java classForName: 'java.lang.Runnable') |
128 |
methodDictionary at: #'run()V'. |
|
758 | 129 |
self assertTrue: (result = expectedResult). |
130 |
||
131 |
"Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
132 |
"Modified: / 23-05-2011 / 17:18:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 133 |
! |
134 |
||
135 |
testInvalidation |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
136 |
| javaMethodRef initString| |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
137 |
|
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
138 |
initString :='Ljava/lang/Runnable;'. |
758 | 139 |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
140 |
javaMethodRef := javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
141 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
142 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
143 |
inClass: initString. |
758 | 144 |
self assertTrue: (javaMethodRef isResolved not). |
145 |
javaMethodRef resolve. |
|
146 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
147 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 148 |
javaMethodRef invalidate. |
149 |
self assertTrue: (javaMethodRef isResolved not). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
150 |
self assertTrue: (javaMethodRef classRef isResolved not). |
758 | 151 |
|
152 |
"Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
153 |
"Modified: / 23-05-2011 / 17:19:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 154 |
! |
155 |
||
156 |
testInvalidationForClassNegative |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
157 |
| javaMethodRef initString| |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
158 |
|
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
159 |
initString :='Ljava/lang/Runnable;'. |
758 | 160 |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
161 |
javaMethodRef := javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
162 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
163 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
164 |
inClass: initString. |
758 | 165 |
self assertTrue: (javaMethodRef isResolved not). |
166 |
javaMethodRef resolve. |
|
167 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
168 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 169 |
javaMethodRef invalidateForClass: 'Ljava/lang/Object;'. |
170 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
171 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 172 |
|
173 |
"Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
174 |
"Modified: / 23-05-2011 / 17:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 175 |
! |
176 |
||
177 |
testInvalidationForClassPositive |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
178 |
| javaMethodRef initString| |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
179 |
|
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
180 |
initString :='Ljava/lang/Runnable;'. |
758 | 181 |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
182 |
javaMethodRef := javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
183 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
184 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
185 |
inClass: initString. |
758 | 186 |
self assertTrue: (javaMethodRef isResolved not). |
187 |
javaMethodRef resolve. |
|
188 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
189 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 190 |
javaMethodRef invalidateForClass: 'Ljava/lang/Runnable;'. |
191 |
self assertTrue: (javaMethodRef isResolved not). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
192 |
self assertTrue: (javaMethodRef classRef isResolved not). |
758 | 193 |
|
194 |
"Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
195 |
"Modified: / 23-05-2011 / 17:20:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 196 |
! |
197 |
||
198 |
testResolving |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
199 |
| javaMethodRef initString| |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
200 |
|
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
201 |
initString :='Ljava/lang/Runnable;'. |
758 | 202 |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
203 |
javaMethodRef := javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
204 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
205 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
206 |
inClass: initString. |
758 | 207 |
self assertTrue: (javaMethodRef isResolved not). |
208 |
javaMethodRef resolve. |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
209 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 210 |
self assertTrue: (javaMethodRef isResolved). |
211 |
||
212 |
"Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
213 |
"Modified: / 23-05-2011 / 17:21:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 214 |
! ! |
215 |
||
216 |
!JavaInterfaceMethodRefTests methodsFor:'permission tests'! |
|
217 |
||
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
218 |
testAccessingPublicFromSubclass |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
219 |
| javaMethodRef initString | |
761 | 220 |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
221 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
222 |
self |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
223 |
should: |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
224 |
[ javaMethodRef := self |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
225 |
getInterfaceMethodRefNamed: 'publicMethod' |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
226 |
typed: '()Ljava/lang/String;' |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
227 |
inClass: initString. |
771 | 228 |
javaMethodRef resolve. ] |
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
229 |
raise: Error |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
230 |
suchThat: [:e | e messageText = 'IncompatibleClassChangeError' ]. |
761 | 231 |
|
232 |
"Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
233 |
"Modified: / 23-05-2011 / 17:54:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 234 |
! ! |
235 |
||
236 |
!JavaInterfaceMethodRefTests class methodsFor:'documentation'! |
|
237 |
||
238 |
version_SVN |
|
239 |
^ '$Id$' |
|
240 |
! ! |