< prev index next >

test/compiler/stable/TestStableBoolean.java

Print this page
rev 11353 : 8149043: Fix code indentation in test/compiler/stable tests
Reviewed-by:


  78 
  79         // @Stable Object field: dynamic arrays
  80         run(ObjectArrayLowerDim0.class);
  81         run(ObjectArrayLowerDim1.class);
  82         run(ObjectArrayLowerDim2.class);
  83 
  84         // Nested @Stable fields
  85         run(NestedStableField.class);
  86         run(NestedStableField1.class);
  87         run(NestedStableField2.class);
  88         run(NestedStableField3.class);
  89 
  90         if (failed) {
  91             throw new Error("TEST FAILED");
  92         }
  93     }
  94 
  95     /* ==================================================== */
  96 
  97     static class DefaultValue {
  98         public @Stable
  99         boolean v;
 100 
 101         public static final DefaultValue c = new DefaultValue();
 102         public static boolean get() { return c.v; }
 103         public static void test() throws Exception {
 104             boolean val1 = get();
 105             c.v = true; boolean val2 = get();
 106             assertEquals(val1, false);
 107             assertEquals(val2, true);
 108         }
 109     }
 110 
 111     /* ==================================================== */
 112 
 113     static class BooleanStable {
 114         public @Stable boolean v;
 115 
 116         public static final BooleanStable c = new BooleanStable();
 117         public static boolean get() { return c.v; }
 118         public static void test() throws Exception {
 119             c.v = true; boolean val1 = get();


 589 
 590     public static void run(Class<?> test) {
 591         Throwable ex = null;
 592         System.out.print(test.getName()+": ");
 593         try {
 594             test.getMethod("test").invoke(null);
 595         } catch (InvocationTargetException e) {
 596             ex = e.getCause();
 597         } catch (Throwable e) {
 598             ex = e;
 599         } finally {
 600             if (ex == null) {
 601                 System.out.println("PASSED");
 602             } else {
 603                 failed = true;
 604                 System.out.println("FAILED");
 605                 ex.printStackTrace(System.out);
 606             }
 607         }
 608     }
 609 
 610 }


  78 
  79         // @Stable Object field: dynamic arrays
  80         run(ObjectArrayLowerDim0.class);
  81         run(ObjectArrayLowerDim1.class);
  82         run(ObjectArrayLowerDim2.class);
  83 
  84         // Nested @Stable fields
  85         run(NestedStableField.class);
  86         run(NestedStableField1.class);
  87         run(NestedStableField2.class);
  88         run(NestedStableField3.class);
  89 
  90         if (failed) {
  91             throw new Error("TEST FAILED");
  92         }
  93     }
  94 
  95     /* ==================================================== */
  96 
  97     static class DefaultValue {
  98         public @Stable boolean v;

  99 
 100         public static final DefaultValue c = new DefaultValue();
 101         public static boolean get() { return c.v; }
 102         public static void test() throws Exception {
 103                         boolean val1 = get();
 104             c.v = true; boolean val2 = get();
 105             assertEquals(val1, false);
 106             assertEquals(val2, true);
 107         }
 108     }
 109 
 110     /* ==================================================== */
 111 
 112     static class BooleanStable {
 113         public @Stable boolean v;
 114 
 115         public static final BooleanStable c = new BooleanStable();
 116         public static boolean get() { return c.v; }
 117         public static void test() throws Exception {
 118             c.v = true; boolean val1 = get();


 588 
 589     public static void run(Class<?> test) {
 590         Throwable ex = null;
 591         System.out.print(test.getName()+": ");
 592         try {
 593             test.getMethod("test").invoke(null);
 594         } catch (InvocationTargetException e) {
 595             ex = e.getCause();
 596         } catch (Throwable e) {
 597             ex = e;
 598         } finally {
 599             if (ex == null) {
 600                 System.out.println("PASSED");
 601             } else {
 602                 failed = true;
 603                 System.out.println("FAILED");
 604                 ex.printStackTrace(System.out);
 605             }
 606         }
 607     }

 608 }
< prev index next >