| Modifier and Type | Annotation and Description |
|---|---|
| public @interface | CanIgnoreReturnValue
Indicates that the return value of the annotated API is ignorable. |
| public @interface | CheckReturnValue
Indicates that the return value of the annotated method must be used. |
| public @interface | CompatibleWith
Declares that a parameter to a method must be "compatible with" one of the type parameters in the method's enclosing class, or on the method itself. |
| public @interface | CompileTimeConstant
Annotation for method parameter and class field declarations, which denotes that corresponding actual values must be compile-time constant expressions. |
| public @interface | DoNotCall
Indicates that the annotated method should not be called under any normal circumstances, yet is either impossible to remove, or should not ever be removed. |
| public @interface | DoNotMock
Annotation representing a type that should not be mocked. |
| public @interface | FormatMethod
Annotation for a method that takes a printf-style format string as an argument followed by arguments for that format string. |
| public @interface | FormatString
Annotation for method parameter declarations which denotes that actual parameters will be used as a format string in printf-style formatting. |
| public @interface | ForOverride
Indicates that the annotated method is provided only to be overridden: it should not be
invoked from outside its declaring source file (as if it is |
| public @interface | Immutable
The class to which this annotation is applied is immutable. |
| public @interface | IncompatibleModifiers
Annotation declaring that the target annotation is incompatible with any one of the provided modifiers. |
| public @interface | InlineMe
Indicates that callers of this API should be inlined. |
| public @interface | InlineMeValidationDisabled
An annotation that disables validation of the |
| public @interface | Keep
Indicates that the annotated element should not be removed, and that its visibility, modifiers, type, and name should not be modified. |
| public @interface | MustBeClosed
Annotation for constructors of AutoCloseables or methods that return an AutoCloseable and require that the resource is closed. |
| public @interface | NoAllocation
Annotation for method declarations, which denotes that this method will not cause allocations that are visible from source code. |
| public @interface | OverridingMethodsMustInvokeSuper
Indicates that any concrete method that overrides the annotated method, directly or indirectly,
must invoke |
| public @interface | RequiredModifiers
Annotation declaring that the target annotation requires all the specified modifiers. |
| public @interface | RestrictedApi
Restrict this method to callsites with a allowlist annotation. |
| public @interface | SuppressPackageLocation
Indicates that the PackageLocation warning should be suppressed for this package. |
| public @interface | ThreadSafe
This annotation indicates that the class/interface it is applied to is thread safe An object is thread safe if no sequences of accesses (like reads and writes to public fields or calls to public methods) may put the object into an invalid state, or cause it to violate its contract, regardless of the interleaving of those actions at runtime. |
| public @interface | Var
The parameter or local variable to which this annotation is applied is non-final. |
| Modifier and Type | Enum and Description |
|---|---|
| public enum | Modifier
Modifiers in the Java language, as specified in:
|