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 |
|---|---|
| private static class | |
| public static enum | AccessFlag.
A location within a |
| 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 static final AccessFlag[] | |
| public static final AccessFlag | ENUM
The access flag |
| private static final AccessFlag[] | |
| public static final AccessFlag | |
| private final List | |
| private 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 | |
| private static final AccessFlag[] | |
| private static final AccessFlag[] | |
| public static final AccessFlag | MODULE
The access flag |
| private static final AccessFlag[] | |
| private static final AccessFlag[] | |
| private static final AccessFlag[] | |
| private static final AccessFlag[] | |
| 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 |
|---|---|
| private static AccessFlag[] | |
| private static AccessFlag[] | |
| public Set | Returns: locations this flag can be applied to in the current class file format versionReturns locations this flag can be applied to in the current class file format version. |
| public Set | Returns: locations this flag can be applied to in the given class file format versionthe class file format version to use cffv)Returns locations this flag can be applied to in the given class file format version. |
| public int | Returns: the corresponding mask for the access flagReturns the corresponding 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 the current class file format versionbit 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 the current class file format version. |
| public static Set | Returns: an unmodifiable set of access flags for the given mask value appropriate for the location in the given class file format versionbit mask of access flags mask, AccessFlag.context to interpret mask value location,the class file format to interpret mask value cffv)Returns an unmodifiable set of access flags for the given mask value appropriate for the location in the given class file format version. |
| public boolean | Returns: whether or not this flag has a directly corresponding modifier in the Java programming languageReturns whether or not this flag has a directly corresponding modifier in the Java programming language. |
| private static int | |
| public static AccessFlag | |
| public static AccessFlag[] |