Module java.base

Enum Class AccessFlag

java.lang.Object
java.lang.Enum<AccessFlag>
java.lang.reflect.AccessFlag
All Implemented Interfaces:
Serializable, Comparable<AccessFlag>, Constable

public enum AccessFlag extends Enum<AccessFlag>
Represents a JVM access or module-related flag on a runtime member, such as a class, field, or method.

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.

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.
Implementation Requirements:
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.
Since:
20
See Also: