Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#321 java.lang.NullPointerException on enum files

release_4.0
closed
5
2014-07-23
2005-05-03
Santiago Rilova
No

Processing the following code generates a
java.lang.NullPointerException on line 0. The rest of the
file is parsed correctly:

public enum TEnum
{
FIRST,
SECOND;

public int value()
{
    return 3;
}

}

Using 4.0beta2 and the sun_checks.xml provided with
the distribution.

Discussion

  • Logged In: YES
    user_id=746148

    May 4, 2005 12:48:15 PM
    com.puppycrawl.tools.checkstyle.TreeWalker process
    FINE: Throwable occured.
    java.lang.NullPointerException
    at
    com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck.findContainingClass(DesignForExtensionCheck.java:149)
    at
    com.puppycrawl.tools.checkstyle.checks.design.DesignForExtensionCheck.visitToken(DesignForExtensionCheck.java:102)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:465)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:437)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:448)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:448)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:448)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:448)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:448)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:441)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:448)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:448)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:448)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:448)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:441)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:392)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:221)
    at
    com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:556)
    at
    com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:238)
    at com.puppycrawl.tools.checkstyle.Main.main(Main.java:126)

     
  • Logged In: YES
    user_id=746148

    it looks like DesignForExtension check needs to be modified
    to work
    well with enums :(
    Needs to be fixed before 4.0 released

     
  • Logged In: YES
    user_id=746148

    Fixed in CVS for 4.0