< prev index next >

src/java.base/share/classes/java/lang/reflect/Executable.java

Print this page
@@ -212,19 +212,23 @@
  
      /**
       * {@return an unmodifiable set of the {@linkplain AccessFlag
       * access flags} for the executable represented by this object,
       * possibly empty}
+      * The {@code AccessFlags} may depend on the class file format version of the class.
       *
       * @see #getModifiers()
       * @jvms 4.6 Methods
       * @since 20
       */
      @Override
      public Set<AccessFlag> accessFlags() {
+         int major = SharedSecrets.getJavaLangAccess().classFileFormatVersion(getDeclaringClass()) & 0xffff;
+         var cffv = ClassFileFormatVersion.fromMajor(major);
          return AccessFlag.maskToAccessFlags(getModifiers(),
-                                             AccessFlag.Location.METHOD);
+                                             AccessFlag.Location.METHOD,
+                                             cffv);
      }
  
      /**
       * Returns an array of {@code TypeVariable} objects that represent the
       * type variables declared by the generic declaration represented by this
< prev index next >