-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Description
Rule : ArrayTypeStyle
The ArrayTypeStyle seems to fail when checking the declaration inside nested generics. It works as expected with the 8.43 but fails with the 8.44.
// Test.java
public class Test {
protected Pair<Integer, Object>[] values1; // OK
protected Pair<Integer, Pair<String, Object>[]>[] values2; // OK
protected Pair<Integer, Pair<String, Pair<String, Object>>[]>[] values3a; // KO!
protected Pair<
Integer,
Pair<
String,
Pair<String, Object>
>[]
>[] values3b; // OK, but in fact it's the same as "values3a" with another format
protected static class Pair<L, R> {
protected L key;
protected R value;
}
}<!-- checkstyle.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="charset" value="UTF-8"/>
<property name="severity" value="error"/>
<module name="SuppressWithPlainTextCommentFilter"/>
<property name="fileExtensions" value="java, properties, xml"/>
<module name="TreeWalker">
<module name="ArrayTypeStyle"/>
</module>
</module>$ java -jar checkstyle-8.44-all.jar -c checkstyle.xml Test.javaStarting audit...
[ERROR] /home/junior/Downloads/Test.java:5:66: Array brackets at illegal position. [ArrayTypeStyle]
Audit done.
Checkstyle ends with 1 errors