Home | History | Annotate | Download | only in src
      1 /*
      2  * Test failure to resolve classes.
      3  */
      4 class UnresTest2 {
      5     /*
      6      * Try check-cast and instance-of.
      7      */
      8     static boolean checkCasts(Object obj) {
      9         boolean foo = false;
     10 
     11         try {
     12             UnresClass un = (UnresClass) obj;
     13             assert(false);
     14         } catch (NoClassDefFoundError ncdfe) {
     15             // good
     16         }
     17         try {
     18             foo = obj instanceof UnresClass;
     19             assert(false);
     20         } catch (NoClassDefFoundError ncdfe) {
     21             // good
     22         }
     23 
     24         return foo;
     25     }
     26 
     27     public static void run() {
     28         System.out.println("UnresTest2...");
     29         UnresClass un;
     30         UnresStuff stuff = new UnresStuff();
     31 
     32         try {
     33             un = new UnresClass();
     34             assert(false);
     35         } catch (NoClassDefFoundError ncdfe) {
     36             // good
     37         }
     38 
     39         try {
     40             UnresClass[] uar = new UnresClass[3];
     41             assert(false);
     42         } catch (NoClassDefFoundError ncdfe) {
     43             // good
     44         }
     45 
     46         checkCasts(stuff);
     47         System.out.println("UnresTest2 done");
     48     }
     49 }
     50