#176 Usage checks fail

release_3.3
closed
Rick Giles
Other (70)
5
2012-10-10
2003-11-15
Philip Aston
No

My source has the classes

net.grinder.Console
net.grinder.console.Console

When using any of the usage checks I get the following
exception:

[checkstyle] java.lang.NoClassDefFoundError:
net/grinder/console (wrong name: net/grinder/Console)
[checkstyle] at
java.lang.ClassLoader.defineClass0(Native Method)
[checkstyle] at
java.lang.ClassLoader.defineClass(ClassLoader.java:502)
[checkstyle] at
sun.reflect.GeneratedMethodAccessor16.invoke(Unknown
Source)
[checkstyle] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[checkstyle] at
java.lang.reflect.Method.invoke(Method.java:324)
[checkstyle] at
org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1003)
[checkstyle] at
org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1065)
[checkstyle] at
org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1037)
[checkstyle] at
org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:926)
[checkstyle] at
java.lang.ClassLoader.loadClass(ClassLoader.java:255)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.BaseScope.getClassDefinition(BaseScope.java:86)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefaultScope.getClassDefinition(DefaultScope.java:47)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefaultScope.getClassDefinition(DefaultScope.java:47)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.ClassDef.getClassDefinition(ClassDef.java:146)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefaultScope.getClassDefinition(DefaultScope.java:47)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefaultScope.getClassDefinition(DefaultScope.java:47)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.resolveDottedName(Resolver.java:981)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.resolveClass(Resolver.java:1206)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.resolveConstructor(Resolver.java:1351)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.resolveNew(Resolver.java:1249)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.resolveExpression(Resolver.java:604)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.resolveMethod(Resolver.java:1073)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.resolveExpression(Resolver.java:576)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.resolveExpression(Resolver.java:529)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.handleSList(Resolver.java:85)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.handleBlock(Resolver.java:210)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefinitionTraverser.traverse(DefinitionTraverser.java:103)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefinitionTraverser.traverse(DefinitionTraverser.java:68)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefinitionTraverser.traverseChildren(DefinitionTraverser.java:127)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefinitionTraverser.traverse(DefinitionTraverser.java:99)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefinitionTraverser.traverse(DefinitionTraverser.java:65)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefinitionTraverser.traverseChildren(DefinitionTraverser.java:127)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefinitionTraverser.traverse(DefinitionTraverser.java:90)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefinitionTraverser.traversePackage(DefinitionTraverser.java:119)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefinitionTraverser.traverse(DefinitionTraverser.java:80)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.DefinitionTraverser.traverse(DefinitionTraverser.java:47)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.Resolver.resolve(Resolver.java:78)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.TableMaker.resolveReferences(TableMaker.java:194)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.TableMaker.getTable(TableMaker.java:91)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.ASTManager.buildTree(ASTManager.java:98)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.ASTManager.getCheckNodes(ASTManager.java:153)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck.finishTree(AbstractUsageCheck.java:112)
[checkstyle] at
com.puppycrawl.tools.checkstyle.TreeWalker.notifyEnd(TreeWalker.java:392)
[checkstyle] at
com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:364)
[checkstyle] at
com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:215)
[checkstyle] at
com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:510)
[checkstyle] at
com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:287)
[checkstyle] at
com.puppycrawl.tools.checkstyle.CheckStyleTask.execute(CheckStyleTask.java:248)
[checkstyle] at
org.apache.tools.ant.Task.perform(Task.java:319)
[checkstyle] at
org.apache.tools.ant.Target.execute(Target.java:309)
[checkstyle] at
org.apache.tools.ant.Target.performTasks(Target.java:336)
[checkstyle] at
org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[checkstyle] at
org.apache.tools.ant.Project.executeTargets(Project.java:1250)
[checkstyle] at
org.apache.tools.ant.Main.runBuild(Main.java:610)
[checkstyle] at
org.apache.tools.ant.Main.start(Main.java:196)
[checkstyle] at
org.apache.tools.ant.Main.main(Main.java:235)

which appears to underly:

[checkstyle] java.lang.NullPointerException
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.OneMethodPrivateFieldCheck.getReferences(OneMethodPrivateFieldCheck.java:132)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.OneMethodPrivateFieldCheck.applyTo(OneMethodPrivateFieldCheck.java:87)
[checkstyle] at
com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck.finishTree(AbstractUsageCheck.java:114)
[checkstyle] at
com.puppycrawl.tools.checkstyle.TreeWalker.notifyEnd(TreeWalker.java:392)
[checkstyle] at
com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:364)
[checkstyle] at
com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:215)
[checkstyle] at
com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:510)
[checkstyle] at
com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:287)
[checkstyle] at
com.puppycrawl.tools.checkstyle.CheckStyleTask.execute(CheckStyleTask.java:248)
[checkstyle] at
org.apache.tools.ant.Task.perform(Task.java:319)
[checkstyle] at
org.apache.tools.ant.Target.execute(Target.java:309)
[checkstyle] at
org.apache.tools.ant.Target.performTasks(Target.java:336)
[checkstyle] at
org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[checkstyle] at
org.apache.tools.ant.Project.executeTargets(Project.java:1250)
[checkstyle] at
org.apache.tools.ant.Main.runBuild(Main.java:610)
[checkstyle] at
org.apache.tools.ant.Main.start(Main.java:196)
[checkstyle] at
org.apache.tools.ant.Main.main(Main.java:235)

Discussion

  • Rick Giles
    Rick Giles
    2003-11-15

    Logged In: YES
    user_id=539926

    I was unable to reproduce this with a trivial configuration
    on my machine.
    Please provide more information:
    OS?
    J2SE version?
    ant version?
    Also, can you upload a failing set of classes, checkstyle
    config file, and ant build.xml file? Thanks.

     
  • Philip Aston
    Philip Aston
    2003-11-16

    Logged In: YES
    user_id=2117

    paston01:philipa% uname -a
    CYGWIN_NT-5.0 paston01 1.5.5(0.94/3/2) 2003-09-20 16:31 i686
    unknown unknown Cygwin
    (Cygwin on W2K)

    paston01:philipa% java -fullversion
    java full version "1.4.1_03-b02"

    ANT is not relevant.

    Will attach "bug.jar" which has:
    - Source
    - checkstyle config
    - "run.sh", which contains checkstyle command line

    Displays nearly the same symptoms as above. Difference
    probably to do with changes the checkstyle config since
    raising problem. New problem:

    java.lang.NullPointerException
    at
    com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.ASTUtil.constructDottedName(ASTUtil.java:143)
    at
    com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.AnonymousInnerClass.finishMakingDefinition(AnonymousInnerClass.java:51)
    at
    com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.TableMaker.finishCreatingDefinition(TableMaker.java:138)
    at
    com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.TableMaker.finishCreatingChildren(TableMaker.java:182)
    at
    com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.TableMaker.finishCreatingDefinition(TableMaker.java:163)
    at
    com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.TableMaker.finishCreatingChildren(TableMaker.java:182)

     
  • Philip Aston
    Philip Aston
    2003-11-16

     
    Attachments
  • Rick Giles
    Rick Giles
    2003-11-16

    Logged In: YES
    user_id=539926

    I committed a correction for the NPE bug that occurred in
    the uploaded files. However, I think the original bug is
    still alive. If it occurs again, please upload a failing
    example. Thanks.

     
  • Rick Giles
    Rick Giles
    2003-12-14

    Logged In: YES
    user_id=539926

    Commited a change to CVS that guards against the reported
    NoClassDefFoundError. Could you try the latest CVS, Philip?