author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 11 Jun 2019 22:03:11 +0100 | |
changeset 3914 | 35aa88fa58c1 |
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:#JavaInterfaceMethodRefTests |
749 | 26 |
instanceVariableNames:'' |
27 |
classVariableNames:'' |
|
28 |
poolDictionaries:'' |
|
29 |
category:'Languages-Java-Tests-RuntimeConstantPool' |
|
30 |
! |
|
31 |
||
32 |
!JavaInterfaceMethodRefTests 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 |
!JavaInterfaceMethodRefTests methodsFor:'javaInterfaceMethodRef tests'! |
|
59 |
||
60 |
testCorrectInstanceCreation |
|
61 |
| initString javaMethodRef | |
|
62 |
||
63 |
initString := 'Ljava/lang/Runnable;'. |
|
64 |
javaMethodRef := self |
|
65 |
getInterfaceMethodRefNamed: 'run' |
|
66 |
typed: '()V' |
|
67 |
inClass: initString. |
|
68 |
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
|
69 |
self assertTrue: (javaMethodRef resolvedValue isNil). |
749 | 70 |
self assertTrue: (javaMethodRef name = 'run'). |
71 |
self assertTrue: (javaMethodRef descriptor = '()V'). |
|
72 |
self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/Runnable;'). |
|
73 |
||
74 |
"Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
75 |
"Modified: / 23-05-2011 / 17:19:00 / 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
|
76 |
"Modified: / 31-01-2014 / 09:13:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 77 |
! |
78 |
||
79 |
testCorrectResolving |
|
80 |
| initString javaMethodRef expectedResult result | |
|
81 |
||
82 |
initString := 'Ljava/lang/Runnable;'. |
|
83 |
javaMethodRef := self |
|
84 |
getInterfaceMethodRefNamed: 'run' |
|
85 |
typed: '()V' |
|
86 |
inClass: initString. |
|
87 |
result := javaMethodRef resolve. |
|
88 |
expectedResult := (Java classForName: 'java.lang.Runnable') |
|
89 |
methodDictionary at: #'run()V'. |
|
90 |
self assertTrue: (result = expectedResult). |
|
91 |
||
92 |
"Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
93 |
"Modified: / 23-05-2011 / 17:18:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
94 |
! |
|
95 |
||
96 |
testInvalidation |
|
97 |
| javaMethodRef initString| |
|
98 |
||
99 |
initString :='Ljava/lang/Runnable;'. |
|
100 |
||
101 |
javaMethodRef := javaMethodRef := self |
|
102 |
getInterfaceMethodRefNamed: 'run' |
|
103 |
typed: '()V' |
|
104 |
inClass: initString. |
|
105 |
self assertTrue: (javaMethodRef isResolved not). |
|
106 |
javaMethodRef resolve. |
|
107 |
self assertTrue: (javaMethodRef isResolved). |
|
108 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
109 |
javaMethodRef invalidate. |
|
110 |
self assertTrue: (javaMethodRef isResolved not). |
|
111 |
self assertTrue: (javaMethodRef classRef isResolved not). |
|
112 |
||
113 |
"Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
114 |
"Modified: / 23-05-2011 / 17:19:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
115 |
! |
|
116 |
||
117 |
testInvalidationForClassNegative |
|
118 |
| javaMethodRef initString| |
|
119 |
||
120 |
initString :='Ljava/lang/Runnable;'. |
|
121 |
||
122 |
javaMethodRef := javaMethodRef := self |
|
123 |
getInterfaceMethodRefNamed: 'run' |
|
124 |
typed: '()V' |
|
125 |
inClass: initString. |
|
126 |
self assertTrue: (javaMethodRef isResolved not). |
|
127 |
javaMethodRef resolve. |
|
128 |
self assertTrue: (javaMethodRef isResolved). |
|
129 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
130 |
javaMethodRef invalidateForClass: 'Ljava/lang/Object;'. |
|
131 |
self assertTrue: (javaMethodRef isResolved). |
|
132 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
133 |
||
134 |
"Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
135 |
"Modified: / 23-05-2011 / 17:20:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
136 |
! |
|
137 |
||
138 |
testInvalidationForClassPositive |
|
139 |
| javaMethodRef initString| |
|
140 |
||
141 |
initString :='Ljava/lang/Runnable;'. |
|
142 |
||
143 |
javaMethodRef := javaMethodRef := self |
|
144 |
getInterfaceMethodRefNamed: 'run' |
|
145 |
typed: '()V' |
|
146 |
inClass: initString. |
|
147 |
self assertTrue: (javaMethodRef isResolved not). |
|
148 |
javaMethodRef resolve. |
|
149 |
self assertTrue: (javaMethodRef isResolved). |
|
150 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
151 |
javaMethodRef invalidateForClass: 'Ljava/lang/Runnable;'. |
|
152 |
self assertTrue: (javaMethodRef isResolved not). |
|
153 |
self assertTrue: (javaMethodRef classRef isResolved not). |
|
154 |
||
155 |
"Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
156 |
"Modified: / 23-05-2011 / 17:20:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
157 |
! |
|
158 |
||
159 |
testResolving |
|
160 |
| javaMethodRef initString| |
|
161 |
||
162 |
initString :='Ljava/lang/Runnable;'. |
|
163 |
||
164 |
javaMethodRef := javaMethodRef := self |
|
165 |
getInterfaceMethodRefNamed: 'run' |
|
166 |
typed: '()V' |
|
167 |
inClass: initString. |
|
168 |
self assertTrue: (javaMethodRef isResolved not). |
|
169 |
javaMethodRef resolve. |
|
170 |
self assertTrue: (javaMethodRef classRef isResolved). |
|
171 |
self assertTrue: (javaMethodRef isResolved). |
|
172 |
||
173 |
"Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
174 |
"Modified: / 23-05-2011 / 17:21:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
175 |
! ! |
|
176 |
||
177 |
!JavaInterfaceMethodRefTests methodsFor:'permission tests'! |
|
178 |
||
179 |
testAccessingPublicFromSubclass |
|
180 |
| javaMethodRef initString | |
|
181 |
||
182 |
initString := 'Lstx/libjava/tests/mocks/PublicClass;'. |
|
183 |
self |
|
184 |
should: |
|
185 |
[ javaMethodRef := self |
|
186 |
getInterfaceMethodRefNamed: 'publicMethod' |
|
187 |
typed: '()Ljava/lang/String;' |
|
188 |
inClass: initString. |
|
189 |
javaMethodRef resolve. ] |
|
190 |
raise: Error |
|
191 |
suchThat: [:e | e messageText = 'IncompatibleClassChangeError' ]. |
|
192 |
||
193 |
"Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
194 |
"Modified: / 23-05-2011 / 17:54:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
195 |
! ! |
|
196 |
||
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 |
3412
df11bb428463
Merged with mercurial revision 4f3cc813be4 (8 changesets total)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3360
diff
changeset
|
200 |
^ '$Header: /cvs/stx/stx/libjava/JavaInterfaceMethodRefTests.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
|
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 |
2731
13f5be2bf83b
Merged d87e89dd5276 and fe83a843a7bf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
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 |