ClassElement, ClassFileElement, FieldElement, MethodElementpublic sealed interface AccessFlags extends ClassElement, MethodElement, FieldElement
ClassBuilder and a FieldBuilder chooses an unspecified default value if access flags are not provided, and a MethodBuilder is always created with access flags. AccessFlags cannot be created via a factory method directly; it can be created with withFlags methods on the respective builders.
A MethodBuilder throws an IllegalArgumentException if it is supplied an AccessFlags object that changes the preexisting ACC_STATIC flag of the builder, because the access flag change may invalidate previously supplied data to the builder.
ClassFileTransform. Other access flags are not elements of a CompoundElement and thus not modeled by AccessFlags; they provide their own flagsMask, flags, and has methods.| Modifier and Type | Method | Description |
|---|---|---|
Set |
flags() |
Returns the access flags, as a set of flag enums. |
int |
flagsMask() |
Returns the access flags, as a bit mask. |
boolean |
has |
Returns whether the specified flag is set. |
AccessFlag.Location |
location() |
Returns the class file location for this element, which is either class, method, or field. |
int flagsMask()
[0, 0xFFFF].Set<AccessFlag> flags()
IllegalArgumentException - if the flags mask has any undefined bit setboolean has(AccessFlag flag)
false.flag - the flag to testAccessFlag.Location location()
class file location for this element, which is either class, method, or field.class file location for this element, which is either class, method, or field
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/AccessFlags.html