We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$ javac test.java (no output) $ cat config.xml <?xml version="1.0"?> <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> <module name="Checker"> <module name="TreeWalker"> <module name="AnnotationLocation"/> </module> </module> $ cat test.java @Ann("foo") class Cls1 {} // violation @Ann(value = "foo") class Cls2 {} // no violation @interface Ann { String value(); } $ RUN_LOCALE="-Duser.language=en -Duser.country=US" $ java $RUN_LOCALE -jar checkstyle-8.17-all.jar -c config.xml test.java Starting audit... [ERROR] test.java:1: Annotation 'Ann' should be alone on line. [AnnotationLocation] Audit done. Checkstyle ends with 1 errors. $ java -jar checkstyle-8.17-all.jar -t test.java CLASS_DEF -> CLASS_DEF [1:0] |--MODIFIERS -> MODIFIERS [1:0] | `--ANNOTATION -> ANNOTATION [1:0] | |--AT -> @ [1:0] | |--IDENT -> Ann [1:1] | |--LPAREN -> ( [1:4] | |--EXPR -> EXPR [1:5] // EXPR here | | `--STRING_LITERAL -> "foo" [1:5] | `--RPAREN -> ) [1:10] |--LITERAL_CLASS -> class [1:12] |--IDENT -> Cls1 [1:18] `--OBJBLOCK -> OBJBLOCK [1:23] |--LCURLY -> { [1:23] `--RCURLY -> } [1:24] CLASS_DEF -> CLASS_DEF [2:0] |--MODIFIERS -> MODIFIERS [2:0] | `--ANNOTATION -> ANNOTATION [2:0] | |--AT -> @ [2:0] | |--IDENT -> Ann [2:1] | |--LPAREN -> ( [2:4] | |--ANNOTATION_MEMBER_VALUE_PAIR -> ANNOTATION_MEMBER_VALUE_PAIR [2:5] | | |--IDENT -> value [2:5] | | |--ASSIGN -> = [2:11] | | `--EXPR -> EXPR [2:13] // EXPR under ANNOTATION_MEMBER_VALUE_PAIR | | `--STRING_LITERAL -> "foo" [2:13] | `--RPAREN -> ) [2:18] |--LITERAL_CLASS -> class [2:20] |--IDENT -> Cls2 [2:26] `--OBJBLOCK -> OBJBLOCK [2:31] |--LCURLY -> { [2:31] `--RCURLY -> } [2:32]
Expected two violations here. The buggy method is AnnotationLocationCheck#isParameterized
AnnotationLocationCheck#isParameterized
private static boolean isParameterized(DetailAST annotation) { return annotation.findFirstToken(TokenTypes.EXPR) != null; }
There should be findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR) also.
findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR)
The text was updated successfully, but these errors were encountered:
Issue checkstyle#6440: AnnotationLocation: named parameters must be c…
88c045a
…onsidered parameters
486e48d
7132c11
97fd742
Issue #6440: AnnotationLocation: named parameters must be considered …
96385e2
…parameters
Fix is merged
Sorry, something went wrong.
No branches or pull requests
Expected two violations here. The buggy method is
AnnotationLocationCheck#isParameterized
There should be
findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR)
also.The text was updated successfully, but these errors were encountered: