- All Implemented Interfaces:
- Serializable,- Comparable<AccessFlag>,- Constable
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. AccessFlagis 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:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumA location within a class file where flags can be applied.Nested classes/interfaces declared in class java.lang.EnumEnum.EnumDesc<E extends Enum<E>>
- 
Enum Constant SummaryEnum ConstantsEnum ConstantDescriptionThe access flagACC_ANNOTATIONwith a mask value of0x2000.The access flagACC_BRIDGEwith a mask value of0x0040The access flagACC_ENUMwith a mask value of0x4000.The access flagACC_INTERFACEwith a mask value of0x0200.The access flagACC_MANDATEDwith a mask value of0x8000.The access flagACC_MODULEwith a mask value of0x8000.The module flagACC_OPENwith a mask value of0x0020.The module requires flagACC_STATIC_PHASEwith a mask value of0x0040.The access flagACC_SUPERwith a mask value of0x0020.The access flagACC_SYNCHRONIZED, corresponding to the source modifiersynchronized, with a mask value of0x0020.The access flagACC_SYNTHETICwith a mask value of0x1000.The module requires flagACC_TRANSITIVEwith a mask value of0x0020.The access flagACC_VARARGSwith a mask value of0x0080.
- 
Method SummaryModifier and TypeMethodDescriptionReturns kinds of constructs the flag can be applied to in the latest class file format version.Returns kinds of constructs the flag can be applied to in the given class file format version.intmask()Returns the corresponding integer mask for the access flag.static Set<AccessFlag> maskToAccessFlags(int mask, AccessFlag.Location location) Returns an unmodifiable set of access flags for the given mask value appropriate for the location in question.booleanReturns whether or not the flag has a directly corresponding modifier in the Java programming language.static AccessFlagReturns the enum constant of this class with the specified name.static AccessFlag[]values()Returns an array containing the constants of this enum class, in the order they are declared.
- 
Enum Constant Details- 
PUBLIC
- 
PRIVATE
- 
PROTECTED
- 
STATIC
- 
FINAL
- 
SUPERThe access flagACC_SUPERwith a mask value of0x0020.- API Note:
- In Java SE 8 and above, the JVM treats the ACC_SUPERflag as set in every class file (JVMS 4.1).
 
- 
OPENThe module flagACC_OPENwith a mask value of0x0020.- See Also:
 
- 
TRANSITIVEThe module requires flagACC_TRANSITIVEwith a mask value of0x0020.- See Also:
 
- 
SYNCHRONIZEDThe access flagACC_SYNCHRONIZED, corresponding to the source modifiersynchronized, with a mask value of0x0020.
- 
STATIC_PHASEThe module requires flagACC_STATIC_PHASEwith a mask value of0x0040.- See Also:
 
- 
VOLATILE
- 
BRIDGEThe access flagACC_BRIDGEwith a mask value of0x0040- See Also:
 
- 
TRANSIENT
- 
VARARGSThe access flagACC_VARARGSwith a mask value of0x0080.- See Also:
 
- 
NATIVE
- 
INTERFACEThe access flagACC_INTERFACEwith a mask value of0x0200.- See Also:
 
- 
ABSTRACT
- 
STRICTThe access flagACC_STRICT, corresponding to the source modifierstrictfp, with a mask value of0x0800.- API Note:
- The ACC_STRICTaccess flag is defined for class file major versions 46 through 60, inclusive (JVMS 4.6), corresponding to Java SE 1.2 through 16.
 
- 
SYNTHETICThe access flagACC_SYNTHETICwith a mask value of0x1000.- See Also:
 
- 
ANNOTATIONThe access flagACC_ANNOTATIONwith a mask value of0x2000.- See Also:
 
- 
ENUMThe access flagACC_ENUMwith a mask value of0x4000.- See Also:
 
- 
MANDATEDThe access flagACC_MANDATEDwith a mask value of0x8000.
- 
MODULEThe access flagACC_MODULEwith a mask value of0x8000.
 
- 
- 
Method Details- 
valuesReturns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
 
- 
valueOfReturns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
- name- the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
- IllegalArgumentException- if this enum class has no constant with the specified name
- NullPointerException- if the argument is null
 
- 
maskpublic int mask()Returns the corresponding integer mask for the access flag.- Returns:
- the corresponding integer mask for the access flag
 
- 
sourceModifierpublic boolean sourceModifier()Returns whether or not the flag has a directly corresponding modifier in the Java programming language.- Returns:
- whether or not the flag has a directly corresponding modifier in the Java programming language
 
- 
locationsReturns kinds of constructs the flag can be applied to in the latest class file format version.- Returns:
- kinds of constructs the flag can be applied to in the latest class file format version
 
- 
locationsReturns kinds of constructs the flag can be applied to in the given class file format version.- Parameters:
- cffv- the class file format version to use
- Returns:
- kinds of constructs the flag can be applied to in the given class file format version
- Throws:
- NullPointerException- if the parameter is- null
 
- 
maskToAccessFlagsReturns an unmodifiable set of access flags for the given mask value appropriate for the location in question.- Parameters:
- mask- bit mask of access flags
- location- context to interpret mask value
- Returns:
- an unmodifiable set of access flags for the given mask value appropriate for the location in question
- Throws:
- IllegalArgumentException- if the mask contains bit positions not support for the location in question
 
 
-