-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
DesignForExtension: NullPointerException #14022
Copy link
Copy link
Closed
Description
I have read check documentation: https://checkstyle.org/checks/design/designforextension.html#DesignForExtension
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
it is not a regresson:
/var/tmp$ cat config.xml
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="TreeWalker">
<module name="DesignForExtensionCheck">
</module>
</module>
</module>
/var/tmp$ cat Test.java
public class Test {
void anotherMethod(String s);
String field;
/**
* @param anObject
* @param field
*/
static void method(Test anObject, String field) {
anObject.anotherMethod(field);
}
}
/var/tmp$ java -jar checkstyle-10.12.4-all.jar -c config.xml Test.java
Starting audit...
com.puppycrawl.tools.checkstyle.api.CheckstyleException: Exception was thrown while processing Test.java
at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:309)
at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:226)
at com.puppycrawl.tools.checkstyle.Main.runCheckstyle(Main.java:415)
at com.puppycrawl.tools.checkstyle.Main.runCli(Main.java:338)
at com.puppycrawl.tools.checkstyle.Main.execute(Main.java:195)
at com.puppycrawl.tools.checkstyle.Main.main(Main.java:130)
Caused by: java.lang.NullPointerException
at com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck.hasEmptyImplementation(DesignForExtensionCheck.java:360)
at com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck.visitToken(DesignForExtensionCheck.java:256)
at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:335)
at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:406)
at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:273)
at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:158)
at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:101)
at com.puppycrawl.tools.checkstyle.Checker.processFile(Checker.java:337)
at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:296)
... 5 more
Checkstyle ends with 1 errors.
Describe what you expect in detail.
No exception.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels