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