@Documented @Retention(value=CLASS) @Target(value=ANNOTATION_TYPE) public @interface RequiredModifiers
@RequiredModifiers(modifier = Modifier.PUBLIC) @interface MyAnnotation {}
will be considered illegal when used on non-public elements such as:
@MyAnnotation void foo() {}
Modifier and Type | Optional Element and Description |
---|---|
Modifier[] |
modifier
The required modifiers.
|
Modifier[] |
value
Deprecated.
use
modifier() instead |
@Deprecated public abstract Modifier[] value
modifier()
insteadpublic abstract Modifier[] modifier
Empty array has the same effect as not applying this annotation at all; duplicates are allowed but have no effect.
Copyright © 2021 Google LLC. All rights reserved.