#997 Rule NonThreadSafeSingleton gives analysis problem

PMD-5.0.3
closed
pmd (543)
PMD
3-Major
Bug
2013-04-05
2012-03-21
Anonymous
No

When analyzing the attached file with pmd 4.2.5 with rule NonThreadSafeSingleton (design) enabled, analysis gives

Error while processing A.java

when commenting out the cast on line 8, the problem disappears.

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-03-21

    Reproduction input file

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-03-21

    Patch

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-03-21

    The problem is a ClassCastException. An AST(Cast)Expression was coerced into an ASTName without check. Added a minimal patch that alleviates the problem.

     
  • Romain PELISSE

    Romain PELISSE - 2012-03-22

    Hi,

    Thanks a lot for your bug report and even more for your patch. I successfully reproduced the error using the provided class and the internal test framework for PMD. I also applied your patch - but the test still fails. I have to double check what I did, so the problem can definitely be on my side, but I wanted to keep your information of the progress made on this issue.

    Note that your patch was made against PMD 4.3.x but I work against the trunk (PMD 5.0). Indeed, there is no plan to release a new version of PMD 4.x.

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-03-22

    Thanks for the update. The patch was against 4.2.5 (sorry, yes, we use an old version). I do not think it is a problem for us to upgrade to 5.0 when it is officially released.

    Good luck with the fix!

     
  • Andreas Dangel

    Andreas Dangel - 2013-03-16
    • status: open --> in-progress
    • assigned_to: Romain PELISSE --> Andreas Dangel
    • module: --> PMD
    • milestone: --> PMD-5.0.3
    • priority: 5 --> 3-Major
    • type: --> Bug
    • affects_version: -->
     
  • Andreas Dangel

    Andreas Dangel - 2013-03-17
    • status: in-progress --> closed
     

Log in to post a comment.