author | Stefan Vogel <sv@exept.de> |
Thu, 25 Apr 2013 15:09:57 +0200 | |
changeset 2552 | f4c15588965e |
parent 2396 | fadc6d7a2f5b |
child 2429 | ebece4dcaab9 |
child 2678 | c865275e48a7 |
permissions | -rw-r--r-- |
749 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 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 |
|
749 | 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 |
||
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 |
||
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
|
23 |
JavaRefsAndConstantPoolTestCase subclass:#JavaInterfaceMethodRefTests |
749 | 24 |
instanceVariableNames:'' |
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Tests-RuntimeConstantPool' |
|
28 |
! |
|
29 |
||
30 |
!JavaInterfaceMethodRefTests class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 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
|
35 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
36 |
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
|
37 |
|
749 | 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 |
||
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
|
48 |
[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
|
49 |
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
|
50 |
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
|
51 |
as of 1.9.2010 |
749 | 52 |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
56 |
|
749 | 57 |
!JavaInterfaceMethodRefTests methodsFor:'javaInterfaceMethodRef tests'! |
58 |
||
59 |
testCorrectInstanceCreation |
|
60 |
| initString javaMethodRef | |
|
61 |
||
62 |
initString := 'Ljava/lang/Runnable;'. |
|
63 |
javaMethodRef := self |
|
64 |
getInterfaceMethodRefNamed: 'run' |
|
65 |
typed: '()V' |
|
66 |
inClass: initString. |
|
67 |
self assertTrue: (javaMethodRef isResolved not). |
|
68 |
self assertTrue: (javaMethodRef valueCache isNil). |
|
69 |
self assertTrue: (javaMethodRef name = 'run'). |
|
70 |
self assertTrue: (javaMethodRef descriptor = '()V'). |
|
71 |
self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/Runnable;'). |
|
72 |
||
73 |
"Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
74 |
"Modified: / 23-05-2011 / 17:19:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
75 |
! |
|
76 |
||
77 |
testCorrectResolving |
|
78 |
| initString javaMethodRef expectedResult result | |
|
79 |
||
80 |
initString := 'Ljava/lang/Runnable;'. |
|
81 |
javaMethodRef := self |
|
82 |
getInterfaceMethodRefNamed: 'run' |
|
83 |
typed: '()V' |
|
84 |
inClass: initString. |
|
85 |
result := javaMethodRef resolve. |
|
86 |
expectedResult := (Java classForName: 'java.lang.Runnable') |
|
87 |
methodDictionary at: #'run()V'. |
|
88 |
self assertTrue: (result = expectedResult). |
|
89 |
||
90 |
"Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
91 |
"Modified: / 23-05-2011 / 17:18:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
92 |
! |
|
93 |
||
94 |
testInvalidation |
|
95 |
| javaMethodRef initString| |
|
96 |
||
97 |
initString :='Ljava/lang/Runnable;'. |
|
98 |
||
99 |
javaMethodRef := javaMethodRef := self |
|
100 |
getInterfaceMethodRefNamed: 'run' |
|
101 |
typed: '()V' |
|
102 |
inClass: initString. |
|
103 |
self assertTrue: (javaMethodRef isResolved not). |
|
104 |
javaMethodRef resolve. |
|
105 |
self assertTrue: (javaMethodRef isResolved). |
|
106 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
107 |
javaMethodRef invalidate. |
|
108 |
self assertTrue: (javaMethodRef isResolved not). |
|
109 |
self assertTrue: (javaMethodRef classRef isResolved not). |
|
110 |
||
111 |
"Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
112 |
"Modified: / 23-05-2011 / 17:19:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
113 |
! |
|
114 |
||
115 |
testInvalidationForClassNegative |
|
116 |
| javaMethodRef initString| |
|
117 |
||
118 |
initString :='Ljava/lang/Runnable;'. |
|
119 |
||
120 |
javaMethodRef := javaMethodRef := self |
|
121 |
getInterfaceMethodRefNamed: 'run' |
|
122 |
typed: '()V' |
|
123 |
inClass: initString. |
|
124 |
self assertTrue: (javaMethodRef isResolved not). |
|
125 |
javaMethodRef resolve. |
|
126 |
self assertTrue: (javaMethodRef isResolved). |
|
127 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
128 |
javaMethodRef invalidateForClass: 'Ljava/lang/Object;'. |
|
129 |
self assertTrue: (javaMethodRef isResolved). |
|
130 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
131 |
||
132 |
"Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
133 |
"Modified: / 23-05-2011 / 17:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
134 |
! |
|
135 |
||
136 |
testInvalidationForClassPositive |
|
137 |
| javaMethodRef initString| |
|
138 |
||
139 |
initString :='Ljava/lang/Runnable;'. |
|
140 |
||
141 |
javaMethodRef := javaMethodRef := self |
|
142 |
getInterfaceMethodRefNamed: 'run' |
|
143 |
typed: '()V' |
|
144 |
inClass: initString. |
|
145 |
self assertTrue: (javaMethodRef isResolved not). |
|
146 |
javaMethodRef resolve. |
|
147 |
self assertTrue: (javaMethodRef isResolved). |
|
148 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
149 |
javaMethodRef invalidateForClass: 'Ljava/lang/Runnable;'. |
|
150 |
self assertTrue: (javaMethodRef isResolved not). |
|
151 |
self assertTrue: (javaMethodRef classRef isResolved not). |
|
152 |
||
153 |
"Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
154 |
"Modified: / 23-05-2011 / 17:20:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
155 |
! |
|
156 |
||
157 |
testResolving |
|
158 |
| javaMethodRef initString| |
|
159 |
||
160 |
initString :='Ljava/lang/Runnable;'. |
|
161 |
||
162 |
javaMethodRef := javaMethodRef := self |
|
163 |
getInterfaceMethodRefNamed: 'run' |
|
164 |
typed: '()V' |
|
165 |
inClass: initString. |
|
166 |
self assertTrue: (javaMethodRef isResolved not). |
|
167 |
javaMethodRef resolve. |
|
168 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
169 |
self assertTrue: (javaMethodRef isResolved). |
|
170 |
||
171 |
"Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
172 |
"Modified: / 23-05-2011 / 17:21:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
173 |
! ! |
|
174 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
175 |
|
749 | 176 |
!JavaInterfaceMethodRefTests methodsFor:'permission tests'! |
177 |
||
178 |
testAccessingPublicFromSubclass |
|
179 |
| javaMethodRef initString | |
|
180 |
||
181 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
182 |
self |
|
183 |
should: |
|
184 |
[ javaMethodRef := self |
|
185 |
getInterfaceMethodRefNamed: 'publicMethod' |
|
186 |
typed: '()Ljava/lang/String;' |
|
187 |
inClass: initString. |
|
188 |
javaMethodRef resolve. ] |
|
189 |
raise: Error |
|
190 |
suchThat: [:e | e messageText = 'IncompatibleClassChangeError' ]. |
|
191 |
||
192 |
"Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
193 |
"Modified: / 23-05-2011 / 17:54:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
194 |
! ! |
|
195 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
196 |
|
749 | 197 |
!JavaInterfaceMethodRefTests class methodsFor:'documentation'! |
198 |
||
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
|
199 |
version_CVS |
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
200 |
^ '$Header: /cvs/stx/stx/libjava/JavaInterfaceMethodRefTests.st,v 1.3 2013-02-25 11:15:31 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
|
201 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
202 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
203 |
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
|
204 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
205 |
^ '$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
|
206 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2152
diff
changeset
|
207 |
|
749 | 208 |
version_SVN |
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
|
209 |
^ '§Id§' |
2152 | 210 |
! ! |
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
|
211 |