PMD 3.1, a Java Source Code analyser is released.


News: PMD 3.1, a Java Source Code analyser is released.

  1. PMD is a BSD-licensed Java source code analyzer. It finds unused variables, empty catch blocks, unnecessary object creation, and more. It includes CPD, a tool to detect chunks of identical code.

    PMD has plugins for JDeveloper, Eclipse, JEdit, JBuilder, Omnicore's CodeGuide, NetBeans/Sun ONE Studio, IntelliJ IDEA, TextPad, Maven, Ant, Gel, JCreator, and Emacs.

    This release includes eight new rules, a slew of bugfixes, and better support for JDK 1.5. Several rules were optimized; for example, UnusedModifer now runs about ten times faster.

    You can download it from sourceforge.

    Threaded Messages (12)

  2. Keep up the good work PMD Team !!!.

    We have been using PMD throughout the projects and i have to say, 'It Rocks !!'.
  3. poor performance[ Go to top ]

    PMD is a nice tool and I have integrated it into our build process. Unfortunately, PMD is also REALLY slow and hogs all CPU. PMD spends about 2-3 seconds per class eventhough I have only a couple of default rulesets enabled. I wonder if it's possible to optimize the code a bit?
  4. We are weighing on Hammurapi, PMD, CheckStyle and Findbugs. Can sombody gives me their opinion on this?
  5. I am also looking at Hammurapi, PMD, CheckStyle and Findbugs. Recommendations, thoughts and opinions would be appreciated.


  6. If you have access to Intellij IDEA then use InspectionGadgets. Best code analyzer around hands down.
  7. PMD+FindBugs[ Go to top ]

    In my team, we use PMD+FindBugs. I evaluated Hammurapi and CheckStyle; I found Hammurapi to be much too slow, and many of the rules are either a little pedantic or just plain obvious. It also is a less polished product than PMD.

    CheckStyle is a solid tool if your team spends a lot of time reformatting each other's code, or you have team members who refuse to follow code conventions. I happen to think it's not an effective use of my team to spend time reformatting code and producing 100% javadoc coverage, so decided that CheckStyle was not for us. Luckily for me we are pretty good at following common code conventions, and nobody on the team freaks out if someone leaves an errant space after a semi-colon.

    FindBugs is a very good partner with PMD because it finds issues that are "deeper" than PMD's analysis. Its explanations of the bugs it finds are excellent. The most valuable bugs it picks up for my team are missing stream closures and inconsistent synchronization behavior. We removed the EI and EI2 rules, which spend a lot of time complaining about methods that return internal arrays, which in practice is not all that evil IMHO.

    PMD is definitely the most "complete" of all the tools mentioned here. Its customizability via XSL rules or code is great, the core rulesets are broad in scope and well thought-out, it works well, and has a good Eclipse plugin. Many of the rules are fairly shallow, insofar as they are more stylistic than genuine bug-analysis rules; you also will definitely want to pick and choose which rules to use. We found it pretty easy to select a ruleset between PMD and FindBugs that we all agreed in theory having zero violations was an attainable goal. We're currently just under one failure per 100 lines of code, which is the best of any commercial project I've been on.

    To throw another name in the mix, Lint is a tool that I have been intending to integrate, mainly because I like its null-safe checks; it's on my list to integrate into our build when I get some more "downtime".

  8. PMD 3.1 speed[ Go to top ]

    BTW, I read about the potential speed improvements in 3.1, and so not having upgraded for a while, thought I'd check it out versus 2.0.

    The code I ran my rulesets against took 112 seconds with PMD 2.0, and 337 seconds with PMD 3.1!

    I didn't dive into the root cause any further than that, but given that I was running identical rulesets, I won't be upgrading to 3.1 anytime soon.
  9. No support for Java 5.0[ Go to top ]

    I am using the latest eclipse plugin for PMD, it's complaining about JDK5.0 is not supported. If that's the case it a drawback for PMD.

    I am kind of leaning towards Hammurapi, because of its reports.
  10. ...when it's run via the Ant task or from the command line. I think Philippe has modified the Eclipse plugin in CVS to support a "1.5" checkbox. So, it's on the way!


  11. PMD 3.1 speed[ Go to top ]

    Heh, yup, it's a bit slow. If there's any particular rule you feel is really sluggish, please post to the PMD project and I'll see if I can optimize it...


  12. poor performance[ Go to top ]

    Hi John -

    Sure, is there any particular rule you noticed that was slow? Some of the XPath rules are pretty sluggish... but I could port any serious laggards to Java if someone asked for it. By the way, there's a little table here:

    showing the relative rule speeds.


  13. Slow[ Go to top ]

    Nice tool overall, but God, did it became slow in v3 (at least when running Eclipse plugin)! Loads processor 100% and takes forewer to run. I don't recall this being such bad in v2. :-(