You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cat Test.java
public class Test {
private Optional<String> field1;
}
$ 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">
<module name="TreeWalker">
<module name="IllegalType">
<property name="illegalClassNames" value="java.util.Optional" />
<property name="tokens" value="VARIABLE_DEF" />
<property name="memberModifiers" value=""/>
</module>
</module>
</module>
$ java -jar checkstyle-8.36.2-all.jar -c config.xml Test.java
com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module TreeWalker - cannot initialize module IllegalType - Cannot set property 'memberModifiers' to ''
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:482)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:201)
at com.puppycrawl.tools.checkstyle.Main.runCheckstyle(Main.java:404)
at com.puppycrawl.tools.checkstyle.Main.runCli(Main.java:331)
at com.puppycrawl.tools.checkstyle.Main.execute(Main.java:190)
at com.puppycrawl.tools.checkstyle.Main.main(Main.java:125)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module IllegalType - Cannot set property 'memberModifiers' to ''
at com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:125)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:201)
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:477)
... 5 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Cannot set property 'memberModifiers' to ''
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.tryCopyProperty(AutomaticBean.java:241)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:194)
at com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:120)
... 7 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2128)
at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2109)
at org.apache.commons.beanutils.BeanUtilsBean.copyProperty(BeanUtilsBean.java:437)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.tryCopyProperty(AutomaticBean.java:231)
... 9 more
Caused by: java.lang.IllegalArgumentException: given name
at com.puppycrawl.tools.checkstyle.utils.TokenUtil.getTokenId(TokenUtil.java:174)
at com.puppycrawl.tools.checkstyle.checks.coding.IllegalTypeCheck.setMemberModifiers(IllegalTypeCheck.java:828)
... 17 more
Checkstyle ends with 1 errors.
one more case - checkstyle/sonar-checkstyle#338 (comment)
Expected:
java.lang.IllegalArgumentException: unknown TokenTypes value ''
The text was updated successfully, but these errors were encountered: