< prev index next >

test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 23,10 ***
--- 23,11 ---
  
  /*
   * @test
   * @bug 8330467
   * @modules jdk.compiler
+  *          java.base/jdk.internal.misc
   * @library /test/lib
   * @compile BadClassFile.jcod
   *          BadClassFile2.jcod
   *          BadClassFileVersion.jcod
   * @build jdk.test.lib.Utils

*** 47,10 ***
--- 48,11 ---
  import java.nio.file.Paths;
  import java.util.Arrays;
  import java.util.List;
  import java.util.stream.Stream;
  
+ import jdk.internal.misc.PreviewFeatures;
  import jdk.test.lib.compiler.CompilerUtils;
  import jdk.test.lib.Utils;
  
  import static java.lang.classfile.ClassFile.*;
  import static java.lang.constant.ConstantDescs.CD_Enum;

*** 304,11 ***
                  break;
              default:
                  throw new IllegalArgumentException("unexpected access flag: " + accessFlags);
          }
          assertTrue(hc.isHidden());
!         assertEquals(hc.getModifiers(), ACC_PUBLIC | accessFlags);
          assertFalse(hc.isLocalClass());
          assertFalse(hc.isMemberClass());
          assertFalse(hc.isAnonymousClass());
          assertFalse(hc.isArray());
      }
--- 306,15 ---
                  break;
              default:
                  throw new IllegalArgumentException("unexpected access flag: " + accessFlags);
          }
          assertTrue(hc.isHidden());
!         int expectedAccessFlags = ACC_PUBLIC | accessFlags;
+         if ((accessFlags & ACC_INTERFACE) == 0 && PreviewFeatures.isEnabled()) {
+             expectedAccessFlags |= ACC_IDENTITY;
+         }
+         assertEquals(hc.getModifiers(), expectedAccessFlags);
          assertFalse(hc.isLocalClass());
          assertFalse(hc.isMemberClass());
          assertFalse(hc.isAnonymousClass());
          assertFalse(hc.isArray());
      }
< prev index next >