Module java.base
Package java.lang.classfile

# Interface AccessFlags

≠
public abstract sealed interface AccessFlags
extends java.lang.classfile.ClassElement, java.lang.classfile.FieldElement, java.lang.classfile.MethodElement
permits jdk.internal.classfile.impl.AccessFlagsImpl
Comparing master and cf

All Superinterfaces:
  `ClassElement, ClassFileElement, FieldElement, MethodElement`

public sealed interface AccessFlags extends ClassElement, MethodElement, FieldElement
Models the access flags for a class, method, or field. Delivered as a `ClassElement` , `FieldElement` , or `MethodElement` when traversing the corresponding model type.

Since:
  24

The access flags appears exactly once in each class, method, or field; a `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.

API Note:
  The access flags of classes, methods, and fields are modeled as a standalone object to support streaming as elements for `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.
Since:
  24
See Also:
  - `ClassModel.flags()`
  - `FieldModel.flags()`
  - `MethodModel.flags()`
  - `ClassBuilder.withFlags(int)`
  - `FieldBuilder.withFlags(int)`
  - `MethodBuilder.withFlags(int)`

## Methods

- ≠
  public abstract java.util.Set<java.lang.reflect.AccessFlag> flags()
  Comparing master and cf

  ### flags

  Set<AccessFlag> flags()
  Returns the access flags, as a set of flag enums.
  Returns:
    the access flags, as a set of flag enums
  Throws:
    `IllegalArgumentException` - if the flags mask has any undefined bit set
  See Also:
    Moved to a definition list with class notes.Moved to a definition.Moved to an unordered list with class tag-list.
    - `location()`
- =
  public abstract int flagsMask()
- ≠
  public abstract boolean has(java.lang.reflect.AccessFlag arg0)
  Comparing master and cf

  ### has

  boolean has (AccessFlag flag)
  Returns whether the specified flag is presentset. The specified flag should be a valid flag for the classfile location associated with this element otherwise false is returnedIf the specified flag is not available to this location, returns `false` .
  Parameters:
    `flag` - the flag to test
  Returns:
    whether the specified flag is present
    set
  See Also:
    - `location()`
- ≠
  public abstract java.lang.reflect.AccessFlag.Location location()
  Comparing master and cf

  ### location

  AccessFlag.Location location()
  Returns the classfile `class` file location for this element, which is either class, method, or field.
  Returns:
    the classfile `class` file location for this element, which is either class, method, or field
  See Also:
    Moved to a definition list with class notes.Moved to a definition.Moved to an unordered list with class tag-list.
    - `AccessFlag.Location.CLASS`
    - `AccessFlag.Location.FIELD`
    - `AccessFlag.Location.METHOD`

## Summary

Differences
| Elements | Comments | Descriptions | Total
Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed
--- | --- | --- | --- | --- | --- | --- | --- | ---
AccessFlags |  |  |  |  |  |  | 3 |  | 6 | 9
flags() |  |  |  |  |  |  | 9 |  |  | 9
has(AccessFlag) |  |  |  |  |  |  | 6 | 2 | 1 | 9
location() |  |  |  |  |  |  | 7 |  | 2 | 9
Total |  |  |  |  |  |  | 25 | 2 | 9 | 36