-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Open
Description
I have read check documentation: https://checkstyle.sourceforge.io/config_blocks.html#RightCurly
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
/var/tmp $ javac Test.java
/var/tmp $ 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">
<property name="severity" value="error"/>
<property name="fileExtensions" value="java, properties, xml"/>
<module name="TreeWalker">
<module name="RightCurly">
<property name="option" value="alone_or_singleline"/>
<property name="tokens" value="LITERAL_TRY , LITERAL_CATCH , LITERAL_FINALLY , LITERAL_IF , LITERAL_ELSE , CLASS_DEF , METHOD_DEF , CTOR_DEF , LITERAL_FOR , LITERAL_WHILE , LITERAL_DO , STATIC_INIT , INSTANCE_INIT , ANNOTATION_DEF , ENUM_DEF , INTERFACE_DEF , RECORD_DEF , COMPACT_CTOR_DEF"/>
</module>
</module>
</module>
/var/tmp $ cat Test.java
public class Test {
Object o = new Object() {
}; int i = 0; // should report a warning here
}
/var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
/var/tmp $ java -jar checkstyle-10.1-all.jar -c config.xml Test.java
Starting audit...
Audit done.Describe what you expect in detail.
Hi, I found a false negative about this rule RightCurly. Please read above example. We should report a warning in line 3 because statement is not allowed on same line after curly right brace. Thanks for your consideration.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels