diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java index ea29cea4a..940ccf5a6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java @@ -29,6 +29,13 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtils; * By default, Check enforce to locate annotations immediately after * documentation block and before target element, annotation should be located * on separate line from target element. + *

+ * Attention: Annotations among modifiers are ignored (looks like false-negative) + * as there might be a problem with annotations for return types + *

public @Nullable Long getStartTimeOrNull() { ... }
. + * Such annotations are better to keep close to type. + * Due to limitations Checkstyle can not examin target of annotation. + *

* *

* Example: diff --git a/src/xdocs/config_annotation.xml b/src/xdocs/config_annotation.xml index 0176a311c..2e1185ff0 100644 --- a/src/xdocs/config_annotation.xml +++ b/src/xdocs/config_annotation.xml @@ -28,6 +28,12 @@ By default, Check enforce to locate annotations immediately after documentation block and before target element, annotation should be located on separate line from target element.

+

+ Attention: Annotations among modifiers are ignored (looks like false-negative) + as there might be a problem with annotations for return types public @Nullable Long getStartTimeOrNull() { ... } + Such annotations are better to keep close to type. + Due to limitations Checkstyle can not examin target of annotation. +

Example: