New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForbidWildcardAsReturnTypeCheck: NPE on fully qualified annotation #575

Closed
rnveach opened this Issue May 12, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@rnveach
Copy link
Contributor

rnveach commented May 12, 2017

Identified in Issue #571

$ cat TestClass.java
public class TestClass {
    @org.junit.After
    public void doAfterTest() {
    }
}

$ cat TestConfig.xml
<?xml version="1.0"?>
<!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="charset" value="UTF-8"/>

    <module name="TreeWalker">
<module name="com.github.sevntu.checkstyle.checks.design.ForbidWildcardAsReturnType"/>
    </module>
</module>

$ java -jar checkstyle-7.3-sevntu-1.23.0-all.jar -c TestConfig.xml TestClass.java
Starting audit...
com.puppycrawl.tools.checkstyle.api.CheckstyleException: Exception was thrown while processing TestClass.java
    at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:287)
    at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:205)
    at com.puppycrawl.tools.checkstyle.Main.runCheckstyle(Main.java:425)
    at com.puppycrawl.tools.checkstyle.Main.runCli(Main.java:359)
    at com.puppycrawl.tools.checkstyle.Main.main(Main.java:174)
Caused by: java.lang.NullPointerException
    at com.github.sevntu.checkstyle.checks.design.ForbidWildcardAsReturnTypeCheck.getIdentifier(ForbidWildcardAsReturnTypeCheck.java:270)
    at com.github.sevntu.checkstyle.checks.design.ForbidWildcardAsReturnTypeCheck.hasAnnotation(ForbidWildcardAsReturnTypeCheck.java:288)
    at com.github.sevntu.checkstyle.checks.design.ForbidWildcardAsReturnTypeCheck.visitToken(ForbidWildcardAsReturnTypeCheck.java:195)
    at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:361)
    at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:498)
    at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:303)
    at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:178)
    at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:78)
    at com.puppycrawl.tools.checkstyle.Checker.processFile(Checker.java:307)
    at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:278)
    ... 4 more
Checkstyle ends with 1 errors.

@rnveach rnveach added the approved label May 12, 2017

rnveach added a commit to rnveach/sevntu.checkstyle that referenced this issue May 13, 2017

rnveach added a commit to rnveach/sevntu.checkstyle that referenced this issue May 13, 2017

romani added a commit that referenced this issue May 13, 2017

@romani romani added this to the 1.24.0 milestone May 13, 2017

@romani

This comment has been minimized.

Copy link
Member

romani commented May 13, 2017

fix is merged

@romani romani closed this May 13, 2017

kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Jul 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment