-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
approvedbugfalse negativeissues where check should place violations on code, but does notissues where check should place violations on code, but does not
Milestone
Description
Check documentation : https://checkstyle.org/checks/annotation/annotationonsameline.html#AnnotationOnSameLine
PS D:\CS\test> javac src/Test.java
PS D:\CS\test> cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="TreeWalker">
<module name="AnnotationOnSameLine"/>
</module>
</module>
PS D:\CS\test> cat src/Test.java
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE_USE;
public class Test {
@Ann public // expected violation
@Ann2 class E {}
@Ann private // expected violation
@Ann2 class A {}
@Ann sealed // expected violation
@Ann2 class B permits C {}
@Ann final // expected violation
@Ann2 class C extends B {}
@Target({TYPE_USE}) @interface Ann {}
@Target({TYPE_USE}) @interface Ann2 {}
}
PS D:\CS\test> java -jar checkstyle-10.17.0-all.jar -c config.xml src/Test.java
Starting audit...
Audit done.
The annotation is on the same line with the modifier of the target class, not the target class itself so I expect violations for the above example
Metadata
Metadata
Assignees
Labels
approvedbugfalse negativeissues where check should place violations on code, but does notissues where check should place violations on code, but does not