blob: f1e8dd17eda0b177c528ea263b94f76a7fb4a507 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* Test failure to resolve classes.
*/
class UnresTest2 {
/*
* Try check-cast and instance-of.
*/
static boolean checkCasts(Object obj) {
boolean foo = false;
try {
UnresClass un = (UnresClass) obj;
Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
// good
}
try {
foo = obj instanceof UnresClass;
Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
// good
}
return foo;
}
public static void run() {
System.out.println("UnresTest2...");
UnresClass un;
UnresStuff stuff = new UnresStuff();
try {
un = new UnresClass();
Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
// good
}
try {
UnresClass[] uar = new UnresClass[3];
Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
// good
}
checkCasts(stuff);
System.out.println("UnresTest2 done");
}
}
|