Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
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.
Reproduction input file
You seem to have CSS turned off.
Please don't fill out this field.
The problem is a ClassCastException. An AST(Cast)Expression was coerced into an ASTName without check. Added a minimal patch that alleviates the problem.
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.
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!