• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Test failure to resolve class members.
3  */
4 class UnresTest1 {
run()5     public static void run() {
6         System.out.println("UnresTest1...");
7 
8         UnresStuff stuff = new UnresStuff();
9         try {
10             int x = stuff.instField;
11             Main.assertTrue(false);
12         } catch (NoSuchFieldError nsfe) {
13             // good
14         }
15         try {       // hit the same one a second time
16             int x = stuff.instField;
17             Main.assertTrue(false);
18         } catch (NoSuchFieldError nsfe) {
19             // good
20         }
21         try {
22             stuff.instField = 5;
23             Main.assertTrue(false);
24         } catch (NoSuchFieldError nsfe) {
25             // good
26         }
27 
28         try {
29             double d = stuff.wideInstField;
30             Main.assertTrue(false);
31         } catch (NoSuchFieldError nsfe) {
32             // good
33         }
34         try {
35             stuff.wideInstField = 0.0;
36             Main.assertTrue(false);
37         } catch (NoSuchFieldError nsfe) {
38             // good
39         }
40 
41         try {
42             int y = UnresStuff.staticField;
43             Main.assertTrue(false);
44         } catch (NoSuchFieldError nsfe) {
45             // good
46         }
47         try {
48             UnresStuff.staticField = 17;
49             Main.assertTrue(false);
50         } catch (NoSuchFieldError nsfe) {
51             // good
52         }
53 
54         try {
55             double d = UnresStuff.wideStaticField;
56             Main.assertTrue(false);
57         } catch (NoSuchFieldError nsfe) {
58             // good
59         }
60         try {
61             UnresStuff.wideStaticField = 1.0;
62             Main.assertTrue(false);
63         } catch (NoSuchFieldError nsfe) {
64             // good
65         }
66 
67         try {
68             stuff.virtualMethod();
69             Main.assertTrue(false);
70         } catch (NoSuchMethodError nsfe) {
71             // good
72         }
73         try {
74             UnresStuff.staticMethod();
75             Main.assertTrue(false);
76         } catch (NoSuchMethodError nsfe) {
77             // good
78         }
79     }
80 }
81