Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
AnnotationLocation: add support for PACKAGE_DEF, ENUM_CONSTANT_DEF #6379
$ javac TestClass.java package-info.java
$ cat TestConfig.xml
$ cat TestClass.java
$ RUN_LOCALE="-Duser.language=en -Duser.country=US"
Expected 2 more violations.
referenced this issue
Jan 15, 2019
this is expected behavior, Check is for annotations over declarations, not for linewraps.
I have some worries about TYPECAST usage in this Check. Original idea was to define rules for places where multiline mode is highly used by humans.
Please apply it to our config, if that is not applicable to us, most likely nobody needs this.
Tokens are some sort of targets/modes for Check. It is by design, it is not a bug. If I miss smth, please explain.
How does this explain
I have no problem with this change. It is already an acceptable token. If it isn't working correctly then lets fix it.
I think the check should handle all annotations. Yes, it is unlikely that anyone will use multiline annotations for
Current code probably cost nothing, but maintenance of it will cost a lot. As it is not clear fir what this Check was created. We try to avoid Checks that do all, it never works well. Wr would need to make reasonable behavior to all modes https://checkstyle.org/config_annotation.html#AnnotationLocation_Properties
It is better to update documentation to mention that such Check do not support such cases, and focused on annotations over declarations rather than line wrapping cases.
Does it make sense ?