JVM access and module-related flags are related to, but distinct
from Java language modifiers. Some modifiers
and access flags have a one-to-one correspondence, such as public
. In other cases, some language-level modifiers do
not have an access flag, such as sealed
(JVMS
4.7.31) and some access flags have no corresponding
modifier, such as synthetic.
The values for the constants representing the access and module flags are taken from sections of The Java Virtual Machine Specification including 4.1 (class access and property modifiers), 4.5 (field access and property flags), 4.6 (method access and property flags), 4.7.6 (nested class access and property flags), 4.7.24 (method parameters), and 4.7.25 (module flags and requires, exports, and opens flags).
The mask values for the different access
flags are not distinct. Flags are defined for different
kinds of JVM structures and the same bit position has different
meanings in different contexts. For example, 0x0000_0040
indicates a volatile
field but a bridge method; 0x0000_0080
indicates a transient
field but a variable
arity (varargs) method.
Implementation Specification
The access flag constants are ordered by non-decreasing mask value; that is the mask value of a constant is greater than or equal to the mask value of an immediate neighbor to its (syntactic) left. If new constants are added, this property will be maintained. That implies new constants will not necessarily be added at the end of the existing list.
API Note
The JVM class file format has a new version defined for each new
feature release. A new class
file version may define new access flags or retire old ones. AccessFlag
is intended to model the set of access flags across
class file format versions. The range of versions an access flag is
recognized is not explicitly indicated in this API. See the current
The Java Virtual Machine Specification for
details. Unless otherwise indicated, access flags can be assumed to
be recognized in the current
version.
java.lang.reflect.Modifier
, java.lang.module.ModuleDescriptor.Modifier
, java.lang.module.ModuleDescriptor.Requires.Modifier
, java.lang.module.ModuleDescriptor.Exports.Modifier
, java.lang.module.ModuleDescriptor.Opens.Modifier
, java.compiler/javax.lang.model.element.Modifier
Modifier and Type | Class and Description |
---|---|
public static enum | AccessFlag.
A location within a class file where flags can be applied. |
private static class |
Modifier and Type | Field and Description |
---|---|
public static final AccessFlag | |
public static final AccessFlag | ANNOTATION
The access flag |
public static final AccessFlag | BRIDGE
The access flag |
private final Function | |
public static final AccessFlag | ENUM
The access flag |
public static final AccessFlag | |
public static final AccessFlag | INTERFACE
The access flag |
private final Set | |
public static final AccessFlag | MANDATED
The access flag |
private final int | |
public static final AccessFlag | MODULE
The access flag |
public static final AccessFlag | |
public static final AccessFlag | OPEN
The module flag |
public static final AccessFlag | |
public static final AccessFlag | |
public static final AccessFlag | |
private final boolean | |
public static final AccessFlag | |
public static final AccessFlag | STATIC_PHASE
The module requires flag |
public static final AccessFlag | |
public static final AccessFlag | SUPER
The access flag |
public static final AccessFlag | SYNCHRONIZED
The access flag |
public static final AccessFlag | SYNTHETIC
The access flag |
public static final AccessFlag | |
public static final AccessFlag | TRANSITIVE
The module requires flag |
public static final AccessFlag | VARARGS
The access flag |
public static final AccessFlag |
Access | Constructor and Description |
---|---|
private | AccessFlag(int mask, boolean sourceModifier, Set<AccessFlag.
|
Modifier and Type | Method and Description |
---|---|
public Set | Returns: kinds of constructs the flag can be applied to in the latest class file format versionReturns kinds of constructs the flag can be applied to in the latest class file format version. |
public Set | Returns: kinds of constructs the flag can be applied to in the given class file format versionthe class file format version to use cffv)Returns kinds of constructs the flag can be applied to in the given class file format version. |
public int | Returns: the corresponding integer mask for the access flagReturns the corresponding integer mask for the access flag. |
public static Set | Returns: an unmodifiable set of access flags for the given mask value appropriate for the location in questionbit mask of access flags mask, AccessFlag.context to interpret mask value locationReturns an unmodifiable set of access flags for the given mask value appropriate for the location in question. |
public boolean | Returns: whether or not the flag has a directly corresponding modifier in the Java programming languageReturns whether or not the flag has a directly corresponding modifier in the Java programming language. |
public static AccessFlag | |
public static AccessFlag[] |
ABSTRACT | back to summary |
---|---|
public static final AccessFlag ABSTRACT The access flag |
ANNOTATION | back to summary |
---|---|
public static final AccessFlag ANNOTATION The access flag
|
BRIDGE | back to summary |
---|---|
public static final AccessFlag BRIDGE The access flag
|
cffvToLocations | back to summary |
---|---|
private final Function<ClassFileFormatVersion, Set<AccessFlag. |
ENUM | back to summary |
---|---|
public static final AccessFlag ENUM The access flag
|
FINAL | back to summary |
---|---|
public static final AccessFlag FINAL The access flag |
INTERFACE | back to summary |
---|---|
public static final AccessFlag INTERFACE The access flag
|
locations | back to summary |
---|---|
private final Set<AccessFlag. |
MANDATED | back to summary |
---|---|
public static final AccessFlag MANDATED The access flag |
mask | back to summary |
---|---|
private final int mask |
MODULE | back to summary |
---|---|
public static final AccessFlag MODULE The access flag |
NATIVE | back to summary |
---|---|
public static final AccessFlag NATIVE The access flag |
OPEN | back to summary |
---|---|
public static final AccessFlag OPEN The module flag |
PRIVATE | back to summary |
---|---|
public static final AccessFlag PRIVATE The access flag |
PROTECTED | back to summary |
---|---|
public static final AccessFlag PROTECTED The access flag |
PUBLIC | back to summary |
---|---|
public static final AccessFlag PUBLIC The access flag |
sourceModifier | back to summary |
---|---|
private final boolean sourceModifier |
STATIC | back to summary |
---|---|
public static final AccessFlag STATIC The access flag |
STATIC_PHASE | back to summary |
---|---|
public static final AccessFlag STATIC_PHASE The module requires flag |
STRICT | back to summary |
---|---|
public static final AccessFlag STRICT The access flag API Note The |
SUPER | back to summary |
---|---|
public static final AccessFlag SUPER The access flag API Note In Java SE 8 and above, the JVM treats the |
SYNCHRONIZED | back to summary |
---|---|
public static final AccessFlag SYNCHRONIZED The access flag |
SYNTHETIC | back to summary |
---|---|
public static final AccessFlag SYNTHETIC The access flag |
TRANSIENT | back to summary |
---|---|
public static final AccessFlag TRANSIENT The access flag |
TRANSITIVE | back to summary |
---|---|
public static final AccessFlag TRANSITIVE The module requires flag |
VARARGS | back to summary |
---|---|
public static final AccessFlag VARARGS The access flag
|
VOLATILE | back to summary |
---|---|
public static final AccessFlag VOLATILE The access flag |
AccessFlag | back to summary |
---|---|
private AccessFlag(int mask, boolean sourceModifier, Set<AccessFlag. |
locations | back to summary |
---|---|
public Set Returns kinds of constructs the flag can be applied to in the latest class file format version.
|
locations | back to summary |
---|---|
public Set Returns kinds of constructs the flag can be applied to in the given class file format version.
|
mask | back to summary |
---|---|
public int mask() Returns the corresponding integer mask for the access flag.
|
maskToAccessFlags | back to summary |
---|---|
public static Set Returns an unmodifiable set of access flags for the given mask value appropriate for the location in question.
|
sourceModifier | back to summary |
---|---|
public boolean sourceModifier() Returns whether or not the flag has a directly corresponding modifier in the Java programming language.
|
valueOf | back to summary |
---|---|
public static AccessFlag valueOf(String name) |
values | back to summary |
---|---|
public static AccessFlag[] values() |
Modifier and Type | Field and Description |
---|---|
public static final AccessFlag. | CLASS
Class location. |
private static final Set | |
public static final AccessFlag. | FIELD
Field location. |
public static final AccessFlag. | INNER_CLASS
Inner class location. |
public static final AccessFlag. | METHOD
Method location. |
public static final AccessFlag. | METHOD_PARAMETER
Method parameter location. |
public static final AccessFlag. | MODULE
Module location |
public static final AccessFlag. | MODULE_EXPORTS
Module exports location |
public static final AccessFlag. | MODULE_OPENS
Module opens location |
public static final AccessFlag. | MODULE_REQUIRES
Module requires location |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set | |
private static final Set |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public static AccessFlag. | |
public static AccessFlag. |
CLASS | back to summary |
---|---|
public static final AccessFlag. Class location.
|
EMPTY_SET | back to summary |
---|---|
private static final Set<AccessFlag. |
FIELD | back to summary |
---|---|
public static final AccessFlag. Field location.
|
INNER_CLASS | back to summary |
---|---|
public static final AccessFlag. Inner class location.
|
METHOD | back to summary |
---|---|
public static final AccessFlag. Method location.
|
METHOD_PARAMETER | back to summary |
---|---|
public static final AccessFlag. Method parameter location.
|
MODULE | back to summary |
---|---|
public static final AccessFlag. Module location
|
MODULE_EXPORTS | back to summary |
---|---|
public static final AccessFlag. Module exports location
|
MODULE_OPENS | back to summary |
---|---|
public static final AccessFlag. Module opens location
|
MODULE_REQUIRES | back to summary |
---|---|
public static final AccessFlag. Module requires location
|
SET_CLASS | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_CLASS_FIELD_INNER_CLASS | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_CLASS_FIELD_METHOD | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_CLASS_FIELD_METHOD_INNER_CLASS | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_CLASS_INNER_CLASS | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_CLASS_METHOD | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_CLASS_METHOD_INNER_CLASS | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_FIELD | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_FIELD_METHOD | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_FIELD_METHOD_INNER_CLASS | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_FINAL_8 | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_MANDATED_9 | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_METHOD | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_METHOD_PARAM | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_MODULE | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_MODULE_REQUIRES | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_PUBLIC_1 | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_SYNTHETIC_7 | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_SYNTHETIC_8 | back to summary |
---|---|
private static final Set<AccessFlag. |
SET_SYNTHETIC_9 | back to summary |
---|---|
private static final Set<AccessFlag. |
Location | back to summary |
---|---|
private Location() |
valueOf | back to summary |
---|---|
public static AccessFlag. |
values | back to summary |
---|---|
public static AccessFlag. |
Modifier and Type | Field and Description |
---|---|
private static Map |
Access | Constructor and Description |
---|---|
private |
locationToFlags | back to summary |
---|---|
private static Map<AccessFlag. |
LocationToFlags | back to summary |
---|---|
private LocationToFlags() |