-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Closed
Copy link
Description
This works on classes, great. But it doesn't work on interfaces?
I have read check documentation: https://checkstyle.org/checks/whitespace/emptylineseparator.html#EmptyLineSeparator
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
$ java -version
openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
$ javac -version
javac 17.0.2
$ javac MyInterface.java
# no output, exit code 0
$ cat config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!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="severity" value="warning"/>
<property name="charset" value="UTF-8"/>
<property name="fileExtensions" value="java, properties, xml"/>
<module name="TreeWalker">
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
<property name="allowMultipleEmptyLines" value="false"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
</module>
</module>
</module>
$ cat MyInterface.java
package io.mhagnumdw;
public interface MyInterface {
/**
* Test.
*/
void myMethod();
}
$ RUN_LOCALE="-Duser.language=en -Duser.country=US"
$ java $RUN_LOCALE -jar checkstyle-10.21.4-all.jar -c config.xml MyInterface.java
Starting audit...
Audit done.
It should be reported that there is more than one consecutive blank line. Lines 4 and 5. There should be a WARN from EmptyLineSeparator. The same case, being a class, works correctly.
related issue: #5981