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
/var/tmp $ javac WhatsThis.java --enable-preview --release=15
Note: WhatsThis.java uses preview language features.
Note: Recompile with -Xlint:preview for details.
/var/tmp $ cat config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!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="DesignForExtension"/>
</module>
</module>
/var/tmp $ cat WhatsThis.java
public record WhatsThis(
String whatever
) {
@Override
public String toString() {
return "Whatever " + whatever;
}
}
/var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
/var/tmp $ java $RUN_LOCALE -jar checkstyle-8.36-all.jar -c config.xml WhatsThis.java
Starting audit...
com.puppycrawl.tools.checkstyle.api.CheckstyleException: Exception was thrown while processing WhatsThis.java
at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:311)
at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:221)
at com.puppycrawl.tools.checkstyle.Main.runCheckstyle(Main.java:408)
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: java.lang.NullPointerException: Cannot invoke "com.puppycrawl.tools.checkstyle.api.DetailAST.getType()" because "searchAST" is null
at com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck.getNearestClassOrEnumDefinition(DesignForExtensionCheck.java:437)
at com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck.visitToken(DesignForExtensionCheck.java:278)
at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:340)
at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:451)
at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:278)
at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:155)
at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:87)
at com.puppycrawl.tools.checkstyle.Checker.processFile(Checker.java:337)
at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:298)
... 5 more
Checkstyle ends with 1 errors.
Since records are implicitly final, the DesignForExtension check should ignore records completely.
The text was updated successfully, but these errors were encountered:
Check documentation: https://checkstyle.sourceforge.io/config_design.html#DesignForExtension
Since records are implicitly
final
, theDesignForExtension
check should ignore records completely.The text was updated successfully, but these errors were encountered: