< prev index next >

test/langtools/tools/javac/AnonymousClass/AnonymousClassFlags.java

Print this page
*** 47,42 ***
      private static Map<String, Integer> anonClasses = new LinkedHashMap<>();
  
      // ******* TEST CASES ********
  
      static Object o1 = new Object() {
!         { anonClasses.put(getClass().getName(), 0); }
      };
  
      static void staticMethod() {
          Object o2 = new Object() {
!             { anonClasses.put(getClass().getName(), 0); }
          };
      }
  
      static {
          staticMethod();
  
          Object o3 = new Object() {
!             { anonClasses.put(getClass().getName(), 0); }
          };
      }
  
      Object o4 = new Object() {
!         { anonClasses.put(getClass().getName(), 0); }
      };
  
      void instanceMethod() {
          Object o5 = new Object() {
!             { anonClasses.put(getClass().getName(), 0); }
          };
      }
  
      {
          instanceMethod();
  
          Object o6 = new Object() {
!             { anonClasses.put(getClass().getName(), 0); }
          };
      }
  
      // ******* TEST IMPLEMENTATION ********
  
--- 47,42 ---
      private static Map<String, Integer> anonClasses = new LinkedHashMap<>();
  
      // ******* TEST CASES ********
  
      static Object o1 = new Object() {
!         { anonClasses.put(getClass().getName(), ClassFile.ACC_IDENTITY); }
      };
  
      static void staticMethod() {
          Object o2 = new Object() {
!             { anonClasses.put(getClass().getName(), ClassFile.ACC_IDENTITY); }
          };
      }
  
      static {
          staticMethod();
  
          Object o3 = new Object() {
!             { anonClasses.put(getClass().getName(), ClassFile.ACC_IDENTITY); }
          };
      }
  
      Object o4 = new Object() {
!         { anonClasses.put(getClass().getName(), ClassFile.ACC_IDENTITY); }
      };
  
      void instanceMethod() {
          Object o5 = new Object() {
!             { anonClasses.put(getClass().getName(), ClassFile.ACC_IDENTITY); }
          };
      }
  
      {
          instanceMethod();
  
          Object o6 = new Object() {
!             { anonClasses.put(getClass().getName(), ClassFile.ACC_IDENTITY); }
          };
      }
  
      // ******* TEST IMPLEMENTATION ********
  

*** 103,12 ***
          }
      }
  
      static void assertClassFlags(ClassModel classFile, String name, int expected) {
          int mask = ClassFile.ACC_PUBLIC | ClassFile.ACC_FINAL | ClassFile.ACC_INTERFACE | ClassFile.ACC_ABSTRACT |
!                    ClassFile.ACC_SYNTHETIC | ClassFile.ACC_ANNOTATION | ClassFile.ACC_ENUM;
!         int classExpected = (expected & mask) | ClassFile.ACC_SUPER;
          int classActual = classFile.flags().flagsMask();
          if (classActual != classExpected) {
              throw new AssertionError("Incorrect access_flags for class " + name +
                                       ": expected=" + classExpected + ", actual=" + classActual);
          }
--- 103,12 ---
          }
      }
  
      static void assertClassFlags(ClassModel classFile, String name, int expected) {
          int mask = ClassFile.ACC_PUBLIC | ClassFile.ACC_FINAL | ClassFile.ACC_INTERFACE | ClassFile.ACC_ABSTRACT |
!                    ClassFile.ACC_SYNTHETIC | ClassFile.ACC_ANNOTATION | ClassFile.ACC_ENUM | ClassFile.ACC_IDENTITY;
!         int classExpected = (expected & mask);
          int classActual = classFile.flags().flagsMask();
          if (classActual != classExpected) {
              throw new AssertionError("Incorrect access_flags for class " + name +
                                       ": expected=" + classExpected + ", actual=" + classActual);
          }
< prev index next >