author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 23 Jan 2013 12:31:33 +0000 | |
branch | development |
changeset 1988 | 0fcf5a5dcb66 |
parent 1953 | 1e42ad3fc322 |
child 2069 | 75d40b7b986f |
permissions | -rw-r--r-- |
877 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 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 |
||
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
877 | 20 |
" |
758 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
1515 | 23 |
JavaRefsAndConstantPoolTestCase subclass:#JavaInterfaceMethodRefTests |
758 | 24 |
instanceVariableNames:'' |
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Tests-RuntimeConstantPool' |
|
28 |
! |
|
29 |
||
877 | 30 |
!JavaInterfaceMethodRefTests class methodsFor:'documentation'! |
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 35 |
|
1155 | 36 |
New code and modifications done at SWING Research Group [1]: |
1152 | 37 |
|
877 | 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 |
||
1155 | 48 |
[1] Code written at SWING Research Group contains a signature |
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
1152 | 51 |
as of 1.9.2010 |
877 | 52 |
|
53 |
" |
|
54 |
! ! |
|
758 | 55 |
|
56 |
!JavaInterfaceMethodRefTests methodsFor:'javaInterfaceMethodRef tests'! |
|
57 |
||
58 |
testCorrectInstanceCreation |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
59 |
| initString javaMethodRef | |
758 | 60 |
|
61 |
initString := 'Ljava/lang/Runnable;'. |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
62 |
javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
63 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
64 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
65 |
inClass: initString. |
758 | 66 |
self assertTrue: (javaMethodRef isResolved not). |
67 |
self assertTrue: (javaMethodRef valueCache isNil). |
|
68 |
self assertTrue: (javaMethodRef name = 'run'). |
|
69 |
self assertTrue: (javaMethodRef descriptor = '()V'). |
|
70 |
self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/Runnable;'). |
|
71 |
||
72 |
"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
|
73 |
"Modified: / 23-05-2011 / 17:19:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 74 |
! |
75 |
||
76 |
testCorrectResolving |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
77 |
| initString javaMethodRef expectedResult result | |
758 | 78 |
|
79 |
initString := 'Ljava/lang/Runnable;'. |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
80 |
javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
81 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
82 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
83 |
inClass: initString. |
758 | 84 |
result := javaMethodRef resolve. |
761 | 85 |
expectedResult := (Java classForName: 'java.lang.Runnable') |
86 |
methodDictionary at: #'run()V'. |
|
758 | 87 |
self assertTrue: (result = expectedResult). |
88 |
||
89 |
"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
|
90 |
"Modified: / 23-05-2011 / 17:18:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 91 |
! |
92 |
||
93 |
testInvalidation |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
94 |
| javaMethodRef initString| |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
95 |
|
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
96 |
initString :='Ljava/lang/Runnable;'. |
758 | 97 |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
98 |
javaMethodRef := javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
99 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
100 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
101 |
inClass: initString. |
758 | 102 |
self assertTrue: (javaMethodRef isResolved not). |
103 |
javaMethodRef resolve. |
|
104 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
105 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 106 |
javaMethodRef invalidate. |
107 |
self assertTrue: (javaMethodRef isResolved not). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
108 |
self assertTrue: (javaMethodRef classRef isResolved not). |
758 | 109 |
|
110 |
"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
|
111 |
"Modified: / 23-05-2011 / 17:19:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 112 |
! |
113 |
||
114 |
testInvalidationForClassNegative |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
115 |
| javaMethodRef initString| |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
116 |
|
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
117 |
initString :='Ljava/lang/Runnable;'. |
758 | 118 |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
119 |
javaMethodRef := javaMethodRef := self |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
120 |
getInterfaceMethodRefNamed: 'run' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
121 |
typed: '()V' |
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
122 |
inClass: initString. |
758 | 123 |
self assertTrue: (javaMethodRef isResolved not). |
124 |
javaMethodRef resolve. |
|
125 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
126 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 127 |
javaMethodRef invalidateForClass: 'Ljava/lang/Object;'. |
128 |
self assertTrue: (javaMethodRef isResolved). |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
129 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 130 |
|
131 |
"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
|
132 |
"Modified: / 23-05-2011 / 17:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 133 |
! |
134 |
||
135 |
testInvalidationForClassPositive |
|
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 invalidateForClass: 'Ljava/lang/Runnable;'. |
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 / 16:23:19 / 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:20:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 154 |
! |
155 |
||
156 |
testResolving |
|
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. |
|
815
f98e7173ef67
refactored methodRef tests.. interfaceMethodRefs to come
hlopkmar
parents:
773
diff
changeset
|
167 |
self assertTrue: (javaMethodRef classRef isResolved). |
758 | 168 |
self assertTrue: (javaMethodRef isResolved). |
169 |
||
170 |
"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
|
171 |
"Modified: / 23-05-2011 / 17:21:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 172 |
! ! |
173 |
||
174 |
!JavaInterfaceMethodRefTests methodsFor:'permission tests'! |
|
175 |
||
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
176 |
testAccessingPublicFromSubclass |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
177 |
| javaMethodRef initString | |
761 | 178 |
|
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
179 |
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
|
180 |
self |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
181 |
should: |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
182 |
[ javaMethodRef := self |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
183 |
getInterfaceMethodRefNamed: 'publicMethod' |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
184 |
typed: '()Ljava/lang/String;' |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
185 |
inClass: initString. |
771 | 186 |
javaMethodRef resolve. ] |
816
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
187 |
raise: Error |
4e3072021201
all tests fixed.. updated interfaceMethodRef to checkPermissions (which were not checked until now ehm)
hlopkmar
parents:
815
diff
changeset
|
188 |
suchThat: [:e | e messageText = 'IncompatibleClassChangeError' ]. |
761 | 189 |
|
190 |
"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
|
191 |
"Modified: / 23-05-2011 / 17:54:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
758 | 192 |
! ! |
193 |
||
194 |
!JavaInterfaceMethodRefTests class methodsFor:'documentation'! |
|
195 |
||
1953
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
196 |
version_HG |
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
197 |
|
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
198 |
^ '$Changeset: <not expanded> $' |
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
199 |
! |
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
200 |
|
758 | 201 |
version_SVN |
1953
1e42ad3fc322
Added support Java>>addToClassPath: & Java>>addToSourcePath:. Removed JavaPathElement.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1818
diff
changeset
|
202 |
^ '§Id§' |
758 | 203 |
! ! |