< prev index next >

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

Print this page
*** 212,19 ***
  
      /**
       * {@return an unmodifiable set of the {@linkplain AccessFlag
       * access flags} for the executable represented by this object,
       * possibly empty}
       *
       * @see #getModifiers()
       * @jvms 4.6 Methods
       * @since 20
       */
      @Override
      public Set<AccessFlag> accessFlags() {
          return AccessFlag.maskToAccessFlags(getModifiers(),
!                                             AccessFlag.Location.METHOD);
      }
  
      /**
       * Returns an array of {@code TypeVariable} objects that represent the
       * type variables declared by the generic declaration represented by this
--- 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,
+                                             cffv);
      }
  
      /**
       * Returns an array of {@code TypeVariable} objects that represent the
       * type variables declared by the generic declaration represented by this
< prev index next >