# Class Flags

java.lang.Object
org.eclipse.jdt.core.Flags

public final class Flags extends Object
Utility class for decoding modifier flags in Java elements.

This class provides static methods only.

Note that the numeric values of these flags match the ones for class files as described in the Java Virtual Machine Specification (except for `AccDeprecated`, `AccAnnotationDefault`, and `AccDefaultMethod`).

The AST class `Modifier` provides similar functionality as this class, only in the `org.eclipse.jdt.core.dom` package.

See Also:
  - `IMember.getFlags()`
Restriction:
  This class is not intended to be instantiated by clients.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`AccAbstract`
Abstract property flag.
`static final int`
`AccAnnotation`
Annotation property flag (added in J2SE 1.5).
`static final int`
`AccAnnotationDefault`
Annotation method default property flag.
`static final int`
`AccBridge`
Bridge method property flag (added in J2SE 1.5).
`static final int`
`AccDefault`
Constant representing the absence of any flag.
`static final int`
`AccDefaultMethod`
Default method property flag.
`static final int`
`AccDeprecated`
Deprecated property flag.
`static final int`
`AccEnum`
Enum property flag (added in J2SE 1.5).
`static final int`
`AccFinal`
Final access flag.
`static final int`
`AccInterface`
Interface property flag.
`static final int`
`AccModule`
Module declaration property flag.
`static final int`
`AccNative`
Native property flag.
`static final int`
`AccNonSealed`
Non-sealed property flag.
`static final int`
`AccPrivate`
Private access flag.
`static final int`
`AccProtected`
Protected access flag.
`static final int`
`AccPublic`
Public access flag.
`static final int`
`AccRecord`
Record property flag.
`static final int`
`AccSealed`
Sealed property flag.
`static final int`
`AccStatic`
Static access flag.
`static final int`
`AccStrictfp`
Strictfp property flag.
`static final int`
`AccSuper`
Super property flag.
`static final int`
`AccSynchronized`
Synchronized access flag.
`static final int`
`AccSynthetic`
Synthetic property flag.
`static final int`
`AccTransient`
Transient property flag.
`static final int`
`AccVarargs`
Varargs method property flag (added in J2SE 1.5).
`static final int`
`AccVolatile`
Volatile property flag.

## Method Summary

Modifier and Type
Method
Description
`static boolean`
`isAbstract(int flags)`
Returns whether the given integer includes the `abstract` modifier.
`static boolean`
`isAnnnotationDefault(int flags)`
Returns whether the given integer has the `AccAnnnotationDefault` bit set.
`static boolean`
`isAnnotation(int flags)`
Returns whether the given integer has the `AccAnnotation` bit set.
`static boolean`
`isBridge(int flags)`
Returns whether the given integer has the `AccBridge` bit set.
`static boolean`
`isDefaultMethod(int flags)`
Returns whether the given integer has the `AccDefaultMethod` bit set.
`static boolean`
`isDeprecated(int flags)`
Returns whether the given integer includes the indication that the element is deprecated (`@deprecated` tag in Javadoc comment).
`static boolean`
`isEnum(int flags)`
Returns whether the given integer has the `AccEnum` bit set.
`static boolean`
`isFinal(int flags)`
Returns whether the given integer includes the `final` modifier.
`static boolean`
`isInterface(int flags)`
Returns whether the given integer includes the `interface` modifier.
`static boolean`
`isModule(int flags)`
Returns whether the given integer has the `AccModule` bit set.
`static boolean`
`isNative(int flags)`
Returns whether the given integer includes the `native` modifier.
`static boolean`
`isNonSealed(int flags)`
Returns whether the given integer has the `AccNonSealed` bit set.
`static boolean`
`isPackageDefault(int flags)`
Returns whether the given integer does not include one of the `public`, `private`, or `protected` flags.
`static boolean`
`isPrivate(int flags)`
Returns whether the given integer includes the `private` modifier.
`static boolean`
`isProtected(int flags)`
Returns whether the given integer includes the `protected` modifier.
`static boolean`
`isPublic(int flags)`
Returns whether the given integer includes the `public` modifier.
`static boolean`
`isRecord(int flags)`
Returns whether the given integer has the `AccRecord` bit set.
`static boolean`
`isSealed(int flags)`
Returns whether the given integer has the `AccSealed` bit set.
`static boolean`
`isStatic(int flags)`
Returns whether the given integer includes the `static` modifier.
`static boolean`
`isStrictfp(int flags)`
Returns whether the given integer includes the `strictfp` modifier.
`static boolean`
`isSuper(int flags)`
Returns whether the given integer includes the `super` modifier.
`static boolean`
`isSynchronized(int flags)`
Returns whether the given integer includes the `synchronized` modifier.
`static boolean`
`isSynthetic(int flags)`
Returns whether the given integer includes the indication that the element is synthetic.
`static boolean`
`isTransient(int flags)`
Returns whether the given integer includes the `transient` modifier.
`static boolean`
`isVarargs(int flags)`
Returns whether the given integer has the `AccVarargs` bit set.
`static boolean`
`isVolatile(int flags)`
Returns whether the given integer includes the `volatile` modifier.
`static String`
`toString(int flags)`
Returns a standard string describing the given modifier flags.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### AccDefault

public static final int AccDefault
Constant representing the absence of any flag.

Since:
  3.0
See Also:
  - Constant Field Values

### AccPublic

public static final int AccPublic
Public access flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccPrivate

public static final int AccPrivate
Private access flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccProtected

public static final int AccProtected
Protected access flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccStatic

public static final int AccStatic
Static access flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccFinal

public static final int AccFinal
Final access flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccSynchronized

public static final int AccSynchronized
Synchronized access flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccVolatile

public static final int AccVolatile
Volatile property flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccTransient

public static final int AccTransient
Transient property flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccNative

public static final int AccNative
Native property flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccInterface

public static final int AccInterface
Interface property flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccAbstract

public static final int AccAbstract
Abstract property flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccStrictfp

public static final int AccStrictfp
Strictfp property flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccSuper

public static final int AccSuper
Super property flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccSynthetic

public static final int AccSynthetic
Synthetic property flag. See The Java Virtual Machine Specification for more details.

Since:
  2.0
See Also:
  - Constant Field Values

### AccDeprecated

public static final int AccDeprecated
Deprecated property flag.

Note that this flag's value is internal and is not defined in the Virtual Machine specification.

Since:
  2.0
See Also:
  - Constant Field Values

### AccBridge

public static final int AccBridge
Bridge method property flag (added in J2SE 1.5). Used to flag a compiler-generated bridge methods. See The Java Virtual Machine Specification for more details.

Since:
  3.0
See Also:
  - Constant Field Values

### AccVarargs

public static final int AccVarargs
Varargs method property flag (added in J2SE 1.5). Used to flag variable arity method declarations. See The Java Virtual Machine Specification for more details.

Since:
  3.0
See Also:
  - Constant Field Values

### AccEnum

public static final int AccEnum
Enum property flag (added in J2SE 1.5). See The Java Virtual Machine Specification for more details.

Since:
  3.0
See Also:
  - Constant Field Values

### AccAnnotation

public static final int AccAnnotation
Annotation property flag (added in J2SE 1.5). See The Java Virtual Machine Specification for more details.

Since:
  3.0
See Also:
  - Constant Field Values

### AccDefaultMethod

public static final int AccDefaultMethod
Default method property flag.

Note that this flag's value is internal and is not defined in the Virtual Machine specification.

Since:
  3.10
See Also:
  - Constant Field Values

### AccAnnotationDefault

public static final int AccAnnotationDefault
Annotation method default property flag. Used to flag annotation type methods that declare a default value.

Note that this flag's value is internal and is not defined in the Virtual Machine specification.

Since:
  3.10
See Also:
  - Constant Field Values

### AccModule

public static final int AccModule
Module declaration property flag. Used to flag a compilation unit or a class file that contains a module declaration.

Since:
  3.14
See Also:
  - Constant Field Values

### AccRecord

public static final int AccRecord
Record property flag.

Note that this flag's value is internal and is not defined in the Virtual Machine specification.

Since:
  3.26
See Also:
  - Constant Field Values

### AccSealed

public static final int AccSealed
Sealed property flag.

Note that this flag's value is internal and is not defined in the Virtual Machine specification.

Since:
  3.24
See Also:
  - Constant Field Values

### AccNonSealed

public static final int AccNonSealed
Non-sealed property flag.

Note that this flag's value is internal and is not defined in the Virtual Machine specification.

Since:
  3.24
See Also:
  - Constant Field Values

## Method Details

### isAbstract

public static boolean isAbstract(int flags)
Returns whether the given integer includes the `abstract` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `abstract` modifier is included

### isDeprecated

public static boolean isDeprecated(int flags)
Returns whether the given integer includes the indication that the element is deprecated (`@deprecated` tag in Javadoc comment).

Parameters:
  `flags` - the flags
Returns:
  `true` if the element is marked as deprecated

### isFinal

public static boolean isFinal(int flags)
Returns whether the given integer includes the `final` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `final` modifier is included

### isInterface

public static boolean isInterface(int flags)
Returns whether the given integer includes the `interface` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `interface` modifier is included
Since:
  2.0

### isNative

public static boolean isNative(int flags)
Returns whether the given integer includes the `native` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `native` modifier is included

### isPackageDefault

public static boolean isPackageDefault(int flags)
Returns whether the given integer does not include one of the `public`, `private`, or `protected` flags.

Parameters:
  `flags` - the flags
Returns:
  `true` if no visibility flag is set
Since:
  3.2

### isPrivate

public static boolean isPrivate(int flags)
Returns whether the given integer includes the `private` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `private` modifier is included

### isProtected

public static boolean isProtected(int flags)
Returns whether the given integer includes the `protected` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `protected` modifier is included

### isPublic

public static boolean isPublic(int flags)
Returns whether the given integer includes the `public` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `public` modifier is included

### isStatic

public static boolean isStatic(int flags)
Returns whether the given integer includes the `static` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `static` modifier is included

### isSuper

public static boolean isSuper(int flags)
Returns whether the given integer includes the `super` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `super` modifier is included
Since:
  3.2

### isStrictfp

public static boolean isStrictfp(int flags)
Returns whether the given integer includes the `strictfp` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `strictfp` modifier is included

### isSynchronized

public static boolean isSynchronized(int flags)
Returns whether the given integer includes the `synchronized` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `synchronized` modifier is included

### isSynthetic

public static boolean isSynthetic(int flags)
Returns whether the given integer includes the indication that the element is synthetic.

Parameters:
  `flags` - the flags
Returns:
  `true` if the element is marked synthetic

### isTransient

public static boolean isTransient(int flags)
Returns whether the given integer includes the `transient` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `transient` modifier is included

### isVolatile

public static boolean isVolatile(int flags)
Returns whether the given integer includes the `volatile` modifier.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `volatile` modifier is included

### isBridge

public static boolean isBridge(int flags)
Returns whether the given integer has the `AccBridge` bit set.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `AccBridge` flag is included
Since:
  3.0
See Also:
  - `AccBridge`

### isVarargs

public static boolean isVarargs(int flags)
Returns whether the given integer has the `AccVarargs` bit set.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `AccVarargs` flag is included
Since:
  3.0
See Also:
  - `AccVarargs`

### isEnum

public static boolean isEnum(int flags)
Returns whether the given integer has the `AccEnum` bit set.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `AccEnum` flag is included
Since:
  3.0
See Also:
  - `AccEnum`

### isRecord

public static boolean isRecord(int flags)
Returns whether the given integer has the `AccRecord` bit set.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `AccRecord` flag is included
Since:
  3.26
See Also:
  - `AccRecord`

### isSealed

public static boolean isSealed(int flags)
Returns whether the given integer has the `AccSealed` bit set.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `AccSealed` flag is included
Since:
  3.28
See Also:
  - `AccSealed`

### isNonSealed

public static boolean isNonSealed(int flags)
Returns whether the given integer has the `AccNonSealed` bit set.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `AccNonSealed` flag is included
Since:
  3.28
See Also:
  - `AccNonSealed`

### isAnnotation

public static boolean isAnnotation(int flags)
Returns whether the given integer has the `AccAnnotation` bit set.

Parameters:
  `flags` - the flags
Returns:
  `true` if the `AccAnnotation` flag is included
Since:
  3.0
See Also:
  - `AccAnnotation`

### isDefaultMethod

public static boolean isDefaultMethod(int flags)
Returns whether the given integer has the `AccDefaultMethod` bit set. Note that this flag represents the usage of the 'default' keyword on a method and should not be confused with the 'package' access visibility (which used to be called 'default access').

Returns:
  `true` if the `AccDefaultMethod` flag is included
Since:
  3.10
See Also:
  - `AccDefaultMethod`

### isAnnnotationDefault

public static boolean isAnnnotationDefault(int flags)
Returns whether the given integer has the `AccAnnnotationDefault` bit set.

Returns:
  `true` if the `AccAnnotationDefault` flag is included
Since:
  3.10
See Also:
  - `AccAnnotationDefault`

### isModule

public static boolean isModule(int flags)
Returns whether the given integer has the `AccModule` bit set.

Returns:
  `true` if the `AccModule` flag is included
Since:
  3.14
See Also:
  - `AccModule`

### toString

public static String toString(int flags)
Returns a standard string describing the given modifier flags. Only modifier flags are included in the output; deprecated, synthetic, bridge, etc. flags are ignored.

The flags are output in the following order:

     public protected private
    abstract default static final synchronized native strictfp transient volatile

This order is consistent with the recommendations in JLS8 ("*Modifier:" rules in chapters 8 and 9).

Note that the flags of a method can include the AccVarargs flag that has no standard description. Since the AccVarargs flag has the same value as the AccTransient flag (valid for fields only), attempting to get the description of method modifiers with the AccVarargs flag set would result in an unexpected description. Clients should ensure that the AccVarargs is not included in the flags of a method as follows:

    IMethod method = ...
    int flags = method.getFlags() & ~Flags.AccVarargs;
    return Flags.toString(flags);

Examples results:

      "public static final"
      "private native"

Parameters:
  `flags` - the flags
Returns:
  the standard string representation of the given flags