< prev index next > src/java.base/share/classes/java/lang/reflect/Executable.java
Print this page
import java.util.StringJoiner;
import java.util.stream.Collectors;
import jdk.internal.access.SharedSecrets;
import jdk.internal.vm.annotation.Stable;
+ import jdk.internal.value.PrimitiveClass;
import sun.reflect.annotation.AnnotationParser;
import sun.reflect.annotation.AnnotationSupport;
import sun.reflect.annotation.TypeAnnotationParser;
import sun.reflect.annotation.TypeAnnotation;
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
/**
* {@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
this,
getDeclaringClass(),
getGenericExceptionTypes(),
TypeAnnotation.TypeAnnotationTarget.THROWS);
}
+
+ String getDeclaringClassTypeName() {
+ Class<?> c = getDeclaringClass();
+ if (PrimitiveClass.isPrimitiveClass(c)) {
+ c = PrimitiveClass.asValueType(c);
+ }
+ return c.getTypeName();
+ }
}
< prev index next >