blob: f78bda28eeb8e3fc90488b5144badba4e1f83e81 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import org.aspectj.testing.Tester;
public class InstanceOf {
public static void main(String[] args) {
Tester.expectEvent("instanceOf");
new TargetClass().instanceOf();
Tester.checkAllEvents();
}
}
aspect InstanceOfAspect {
/** @testcase Introduced type unavailable to instanceof expressions in introduced methods */
public void TargetClass.instanceOf() {
/* expecting compiler error,
but only getting compiler warnings and generated class?
-> needs work
*/
// -------- RuntimeException: "Unsupported emit on NotFoundType" Type.java:460
if (!((getboolean()) instanceof boolean)) { Util.fail("boolean"); }
if (!((getchar()) instanceof char)) { Util.fail("char"); }
if (!((getbyte()) instanceof byte)) { Util.fail("byte"); }
if (!((getshort()) instanceof short)) { Util.fail("short"); }
if (!((getint()) instanceof int)) { Util.fail("int"); }
if (!((getlong()) instanceof long)) { Util.fail("long"); }
if (!((getfloat()) instanceof float)) { Util.fail("float"); }
if (!((getdouble()) instanceof double)) { Util.fail("double"); }
// ------ todo: expecting error, get RuntimeException
//if (!((doVoid()) instanceof Void)) { Tester.check(false,"void"); }
Util.signal("instanceOf");
}
}
|