Menu

#1106 PMD 5.0.4 fails with NPE on parsing java enum with inner class instance creation

PMD-5.1.0
closed
None
PMD
2-Critical
Bug
5.0.4
2013-10-09
2013-06-26
No

I've migrated our project from PMD 4.2.5 to PMD 5.0.4.
PMD 5.0.4 fails with NPE on parsing enumeration class with inner class instance creation. It seems that it couldn't find inner type in import section and set it to null then calls method on null object. This bug regards to enumeration classes only.
Test class you may find in attachment.

1 Attachments

Discussion

  • Andreas Dangel

    Andreas Dangel - 2013-08-03
    • status: open --> more-info-needed
    • assigned_to: Andreas Dangel
     
  • Andreas Dangel

    Andreas Dangel - 2013-08-03

    Do you know with which rule this happens? So far PMD can parse the file and I didn't recognize an exception when I run all rules against it.

     
  • Anton Zagorulko

    Anton Zagorulko - 2013-08-19

    Sorry, I've misled you I've got an exception after parsing with message "Error while processing TestInnerInEnum.java". Exception was raised from SourceCodeProcessor.usesTypeResolution method. I've used attached rule set under jdk7u21.

     

    Last edit: Anton Zagorulko 2013-08-19
  • Alexandr Baramykov

    Also got this exception (on pmd 5.0.5). Seems like issue is not about inner class instantiation in enum but anonymous inner class instantiation in enum.

    Command to reproduce using TestInnerInEnum.java, attached by Anthon:
    pmd.bat -d TestInnerInEnum.java -f text -rulesets java-basic -debug >pmd.log 2>&1

    As a result - NPE and stacktrase in pmd.log (attached).

     
  • Andreas Dangel

    Andreas Dangel - 2013-10-09
    • status: more-info-needed --> closed
    • Milestone: PMD-5.0.x --> PMD-5.1.0
     
  • Nathan Toone

    Nathan Toone - 2013-10-09

    So - will this issue be resolved in 5.1.0? I didn't see any commit or patch (which is fine...just want to make sure it wasn't closed accidentally)

     

Log in to post a comment.