diff a/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java b/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java
--- a/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java
+++ b/test/jdk/java/lang/invoke/defineHiddenClass/BasicTest.java
@@ -39,10 +39,11 @@
 import java.lang.invoke.MethodHandles.Lookup;
 
 import static java.lang.invoke.MethodHandles.lookup;
 import static java.lang.invoke.MethodHandles.Lookup.ClassOption.*;
 
+import java.lang.reflect.AccessFlag;
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -112,12 +113,12 @@
         // sanity check
         Class<?> c = t.getClass();
         Class<?>[] intfs = c.getInterfaces();
         assertTrue(c.isHidden());
         assertFalse(c.isPrimitive());
-        assertTrue(intfs.length == 1);
-        assertTrue(intfs[0] == HiddenTest.class);
+        assertTrue(intfs.length == 1 || intfs.length == 2);
+        assertTrue(intfs[0] == HiddenTest.class || (intfs.length == 2 && intfs[1] == HiddenTest.class));
         assertTrue(c.getCanonicalName() == null);
 
         String hcName = "HiddenClass";
         String hcSuffix = "0x[0-9a-f]+";
         assertTrue(c.getName().matches(hcName + "/" + hcSuffix));
@@ -244,13 +245,13 @@
     }
 
     @DataProvider(name = "emptyClasses")
     private Object[][] emptyClasses() {
         return new Object[][] {
-                new Object[] { "EmptyHiddenSynthetic", ACC_SYNTHETIC },
-                new Object[] { "EmptyHiddenEnum", ACC_ENUM },
-                new Object[] { "EmptyHiddenAbstractClass", ACC_ABSTRACT },
+                new Object[] { "EmptyHiddenSynthetic", ACC_SYNTHETIC | ACC_IDENTITY },
+                new Object[] { "EmptyHiddenEnum", ACC_ENUM | ACC_IDENTITY },
+                new Object[] { "EmptyHiddenAbstractClass", ACC_ABSTRACT | ACC_IDENTITY },
                 new Object[] { "EmptyHiddenInterface", ACC_ABSTRACT|ACC_INTERFACE },
                 new Object[] { "EmptyHiddenAnnotation", ACC_ANNOTATION|ACC_ABSTRACT|ACC_INTERFACE },
         };
     }
 
@@ -262,27 +263,27 @@
      * enum class containing constants of its type should not be a hidden
      * class.
      */
     @Test(dataProvider = "emptyClasses")
     public void emptyHiddenClass(String name, int accessFlags) throws Exception {
-        byte[] bytes = (accessFlags == ACC_ENUM) ? classBytes(name, Enum.class, accessFlags)
+        byte[] bytes = (accessFlags == (ACC_ENUM | ACC_IDENTITY)) ? classBytes(name, Enum.class, accessFlags)
                                                  : classBytes(name, accessFlags);
         Class<?> hc = lookup().defineHiddenClass(bytes, false).lookupClass();
         switch (accessFlags) {
-            case ACC_SYNTHETIC:
+            case (ACC_SYNTHETIC | ACC_IDENTITY):
                 assertTrue(hc.isSynthetic());
                 assertFalse(hc.isEnum());
                 assertFalse(hc.isAnnotation());
                 assertFalse(hc.isInterface());
                 break;
-            case ACC_ENUM:
+            case (ACC_ENUM | ACC_IDENTITY):
                 assertFalse(hc.isSynthetic());
                 assertTrue(hc.isEnum());
                 assertFalse(hc.isAnnotation());
                 assertFalse(hc.isInterface());
                 break;
-            case ACC_ABSTRACT:
+            case ACC_ABSTRACT | ACC_IDENTITY:
                 assertFalse(hc.isSynthetic());
                 assertFalse(hc.isEnum());
                 assertFalse(hc.isAnnotation());
                 assertFalse(hc.isInterface());
                 break;
@@ -300,11 +301,11 @@
                 break;
             default:
                 throw new IllegalArgumentException("unexpected access flag: " + accessFlags);
         }
         assertTrue(hc.isHidden());
-        assertTrue(hc.getModifiers() == (ACC_PUBLIC|accessFlags));
+        assertEquals(hc.getModifiers(), (ACC_PUBLIC|accessFlags));
         assertFalse(hc.isLocalClass());
         assertFalse(hc.isMemberClass());
         assertFalse(hc.isAnonymousClass());
         assertFalse(hc.isArray());
     }
