< prev index next >

test/jdk/java/lang/reflect/AccessFlag/BasicAccessFlagTest.java

Print this page
@@ -20,13 +20,23 @@
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   */
  
  /*
-  * @test
-  * @bug 8266670 8293626 8297271
+  * @test id=Basic
+  * @bug 8266670 8281463 8293626 8297271
   * @summary Basic tests of AccessFlag
+  * @modules java.base/jdk.internal.misc
+  * @run junit BasicAccessFlagTest
+  */
+ 
+ /*
+  * @test id=BasicPreview
+  * @bug 8266670 8281463 8293626 8297271
+  * @summary Basic tests of AccessFlag
+  * @modules java.base/jdk.internal.misc
+  * @enablePreview
   * @run junit BasicAccessFlagTest
   */
  
  import java.lang.classfile.ClassFile;
  import java.lang.reflect.AccessFlag;

@@ -37,10 +47,13 @@
  import java.util.Map;
  import java.util.LinkedHashMap;
  import java.util.HashSet;
  import java.util.Set;
  
+ import jdk.internal.misc.PreviewFeatures;
+ 
+ 
  import org.junit.Test;
  import org.junit.jupiter.api.Assertions;
  
  import static org.junit.jupiter.api.Assertions.*;
  

@@ -109,10 +122,12 @@
                  continue;
              }
  
              Set<AccessFlag.Location> locations = new HashSet<>();
              for (var accessFlag : value) {
+                 if (accessFlag.equals(AccessFlag.SUPER))
+                     continue;       // SUPER is defined to overlap with IDENTITY
                  for (var location : accessFlag.locations()) {
                      boolean added = locations.add(location);
                      if (!added) {
                          reportError(location, accessFlag,
                                      entry.getKey(), value);

@@ -139,11 +154,13 @@
          for (var accessFlag : AccessFlag.values()) {
              Set<AccessFlag> expectedSet = EnumSet.of(accessFlag);
              for (var location : accessFlag.locations()) {
                  Set<AccessFlag> computedSet =
                      AccessFlag.maskToAccessFlags(accessFlag.mask(), location);
-                 if (!expectedSet.equals(computedSet)) {
+                 if (!computedSet.containsAll(expectedSet)) {
+                     System.out.println("expected: " + expectedSet);
+                     System.out.println("computed: " + computedSet);
                      throw new RuntimeException("Bad set computation on " +
                                                 accessFlag + ", " + location);
                  }
              }
              for (var cffv : ClassFileFormatVersion.values()) {
< prev index next >