-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Milestone
Description
$ cat TestClass.java
public class TestClass {
void method() {
new Object() { @Override protected void finalize() { "".toString(); } int b = 10; };
}
}
$ cat TestConfig.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">
<property name="charset" value="UTF-8"/>
<module name="TreeWalker">
<module name="RightCurly">
<property name="option" value="alone"/>
<property name="tokens" value="METHOD_DEF, INSTANCE_INIT"/>
</module>
</module>
</module>
$ java -jar checkstyle-7.6-all.jar -c TestConfig.xml TestClass.java
Starting audit...
[ERROR] TestClass.java:3:74: '}' at column 74 should be alone on a line. [RightCurly]
Audit done.
Checkstyle ends with 1 errors.
74 is a position of } for method finalize
Expected: 2 violations on line 3 (column 74 and 89).
89 is a position of } for anonymous class;
} int b = 10; } this two } should be violated.
Note that shouldStartLine (false, true) does not affect the logic. So the problem is in shouldBeAloneOnLine.
Reactions are currently unavailable