< prev index next >

test/langtools/tools/javac/classfiles/InnerClasses/SyntheticClasses.java

Print this page
*** 20,11 ***
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   */
  
  /** @test
!  *  @bug 8034854
   *  @summary Verify that the InnerClasses attribute has outer_class_info_index zero if it has
   *           inner_name_index zero (for synthetic classes)
   *  @compile SyntheticClasses.java
   *  @run main SyntheticClasses
   */
--- 20,11 ---
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   */
  
  /** @test
!  *  @bug 8034854 8287203
   *  @summary Verify that the InnerClasses attribute has outer_class_info_index zero if it has
   *           inner_name_index zero (for synthetic classes)
   *  @compile SyntheticClasses.java
   *  @run main SyntheticClasses
   */

*** 42,10 ***
--- 42,15 ---
  
      private void run() throws IOException {
          File testClasses = new File(System.getProperty("test.classes"));
          for (File classFile : Objects.requireNonNull(testClasses.listFiles(f -> f.getName().endsWith(".class")))) {
              ClassModel cf = ClassFile.of().parse(classFile.toPath());
+             if ((cf.flags().flagsMask() & (ClassFile.ACC_SYNTHETIC | ClassFile.ACC_ABSTRACT)) == ClassFile.ACC_SYNTHETIC) {
+                 if ((cf.flags().flagsMask() & ClassFile.ACC_IDENTITY) == 0) {
+                     throw new IllegalStateException("Missing ACC_IDENTITY on synthetic concrete identity class: " + cf.thisClass().asInternalName());
+                 }
+             }
              if (cf.thisClass().asInternalName().matches(".*\\$[0-9]+")) {
                  EnclosingMethodAttribute encl = cf.findAttribute(Attributes.enclosingMethod()).orElse(null);
                  if (encl != null) {
                      if (encl.enclosingMethodName().isPresent())
                          throw new IllegalStateException("Invalid EnclosingMethod.method: " +
< prev index next >