??? ??, 2008 - 5.0: // TODO Refactor AST o SimpleNode.dump() needs to be implemented as a Visitor TODO - Release blockers - Must implement before this release can be finished o We need to figure out how to allow PMD to introspect the capabilities of each LanguageVersion. Can we parse the language? Can we use DFA? Can we use Type Resolution, etc. Essentially introspection on the stuff on the LanguageVersionHandler and related support classes. This would be useful to allow the PMD Rule Designer to drive its behavior without hard-coding knowledge it rightly should not give a shit about. o Change RuleSets to not specify Language. Move Language onto Rules. This will allow mixed Language RuleSets. Will also allow users to run multiple source files in a single PMD run using a single RuleSet (ie. PMD can sort it all out based on file extension!). o Additional changes to Rule organization withing RuleSets as discussed on this forum thread: http://sourceforge.net/forum/forum.php?thread_id=1323593&forum_id=188194 o Change PMD command line/Ant options to allow specifying Version for multiple languages, not just Java (e.g. remove -targetjdk). Something like "-version java 1.5", one specification per Language. Drop kludgey -jsp and -nojava options. o CPD needs work on use of Language. It currently is hardcoded to only handled Java 1.4. Integrate CPD needs into core PMD where appropriate. Otherwise, drive CPD behavior based off of core PMD, instead of duplicating some logic. o DFA needs a bunch of work yet to be abstracted further to support alternate ASTs, very Java specific at this time. o Do we have a rule to style check for multiple declarations and chained assignments? (e.g. int a, b; int a = b = x;) o Need to refactor the regression test packages to reflect new packaging. o Rework these packages to exist with the net.sourceforge.pmd.lang.* hierarchy: net.sourceforge.pmd.dfa net.sourceforge.pmd.symboltables net.sourceforge.pmd.typeresolution net.sourceforge.pmd.properties o Need a JUnit test to check for "dead" Rules, that is those not used by any RuleSet. o Rule JUnit tests should verify the Test class follows expected naming conventions just like the Rules need to. o Need to organize the ruleset XML files based upon Language. Need to come up with a solution for the "rulesets.properties" files. o Need a more flexible and powerful scheme for classifying files to various Languages. At a minimum, should have the ability to specify which file extensions you want to be used for a language (e.g. not everyone uses .jsp for JSP extensions, some use .jspx, .xhtml, etc.). Also, consider hooks into the LanguageVersionDiscoverer process for classifying a File/String to a LanguageVersion of a specific Language, one could imaging using a 'magic' system like Unix uses to tell different versions of files apart based on actual content. o Some cleanup needs to be done on the PMD class. There are 9! processFile(s) methods, and multiple places which deal with stateful operations (e.g. calling PMD.setExcludeMarker(), PMD.setClassLoader(), RuleSets.start()), further the Benchmarking stuff really only can work for commandline PMD usage, and the RuleSets.start()/end() stuff isn't working for all entry points into the PMD class. Things need to be simplified and centralized. There should be a clear definition of a lifecycle/sequence of events for the PMD class, so that various integration points (command line, Ant, IDEs) can be done in a universal and consistent fashion, and all can necessarily leverage the full PMD feature set. Documentation on this class needs to vastly improved, this should be one of the best documented classes in the code base. o Reconcile the util.designer and util.viewer packages. Two versions of the same thing. Designer is more up to date, but Viewer has a nice MVC design. o Should multiple Languages be able to claim a single source file? Imagine XML format JSP file, for which you've defined a ruleset which uses JSP and XML rules. Stating that certain XML rules also can map to the JSP language extensions could be useful. This means Source file to LanguageVersion mapping is not 1-1, but 1-many, we'd need to deal with this accordingly. o Need to refactor the test framework to more readily support for multiple Languages (too Java centric at the moment). Then, need start adding tests for the new XML language. --- This version of PMD breaks API compatibility with prior versions of PMD, as well as RuleSet XML compatibility. The decision to break compatibility, allows PMD internals and code organization to be improved to better handle additional languages. This opportunity was used to remove depreciated APIs, and beat up any code which has thumbed its nose at the developers over the years. ;) The following is relatively complete list of the major changes (this may not be 100% accurate, see actual source code when in doubt): API Change - Unification of treatment of languages within PMD core: Added - net.sourceforge.pmd.lang.Language (now an 'enum') Added - net.sourceforge.pmd.lang.LanguageVersion Added - net.sourceforge.pmd.lang.LanguageVersionDiscoverer Added - net.sourceforge.pmd.lang.LanguageVersionHandler Added - net.sourceforge.pmd.lang.XPathHandler Added - net.sourceforge.pmd.lang.ast.xpath.AbstractASTXPathHandler Added - net.sourceforge.pmd.lang.xpath.Initializer Added - net.sourceforge.pmd.lang.ast.AbstractTokenManager Added - net.sourceforge.pmd.lang.ast.CharStream Added - net.sourceforge.pmd.lang.ast.JavaCharStream Added - net.sourceforge.pmd.lang.ast.SimpleCharStream Added - net.sourceforge.pmd.lang.ast.TokenMgrError Added - net.sourceforge.pmd.lang.rule.stat.StatisticalRule Added - net.sourceforge.pmd.lang.rule.stat.StatisticalRuleHelper Added - net.sourceforge.pmd.lang.java.rule.AbstractStatisticalJavaRule Added - net.sourceforge.pmd.lang.rule.AbstractRuleViolationFactory Added - net.sourceforge.pmd.lang.rule.RuleViolationFactory Added - net.sourceforge.pmd.lang.java.rule.JavaRuleViolationFactory Added - net.sourceforge.pmd.lang.jsp.rule.JspRuleViolationFactory Renamed - net.sourceforge.pmd.AbstractRule to net.sourceforge.pmd.lang.rule.AbstractRule Renamed - net.sourceforge.pmd.AbstractJavaRule to net.sourceforge.pmd.lang.java.rule.AbstractJavaRule Renamed - net.sourceforge.pmd.AbstractRuleChainVisitor to net.sourceforge.pmd.lang.rule.AbstractRuleChainVisitor Renamed - net.sourceforge.pmd.RuleChainVisitor to net.sourceforge.pmd.lang.rule.RuleChainVisitor Renamed - net.sourceforge.pmd.rule.XPathRule to net.sourceforge.pmd.lang.rule.XPathRule Renamed - net.sourceforge.pmd.jsp.rule.AbstractJspRule to net.sourceforge.pmd.lang.jsp.rule.AbstractJspRule Renamed - net.sourceforge.pmd.ast.CompilationUnit to net.sourceforge.pmd.lang.ast.RootNode Renamed - net.sourceforge.pmd.ast.JavaRuleChainVisitor to net.sourceforge.pmd.lang.java.rule.JavaRuleChainVisitor Renamed - net.sourceforge.pmd.jsp.ast.JspRuleChainVisitor to net.sourceforge.pmd.lang.jsp.rule.JspRuleChainVisitor Renamed - net.sourceforge.pmd.parser.Parser to net.sourceforge.pmd.lang.Parser Renamed - net.sourceforge.pmd.parser.TokenManager to net.sourceforge.pmd.lang.TokenManager Renamed - net.sourceforge.pmd.parser.* into net.sourceforge.pmd.lang.{Language} Renamed - net.sourceforge.pmd.sourcetypehandlers.SourceTypeHandler to net.sourceforge.pmd.lang.LanguageVersionHandler Renamed - net.sourceforge.pmd.sourcetypehandlers.VisitorStarter to net.sourceforge.pmd.lang.VisitorStarter Renamed - net.sourceforge.pmd.sourcetypehandlers.* into net.sourceforge.pmd.lang.{Language} Renamed - net.sourceforge.pmd.stat.StatisticalRule to net.sourceforge.pmd.lang.rule.StatisticalRuleHelper Renamed - net.sourceforge.pmd.jaxen.TypeOfFunction to net.sourceforge.pmd.lang.java.xpath.TypeOfFunction Renamed - net.sourceforge.pmd.jaxen.MatchesFunction to net.sourceforge.pmd.lang.xpath.MatchesFunction Renamed - net.sourceforge.pmd.jaxen.Attribute to net.sourceforge.pmd.lang.ast.xpath.Attribute Renamed - net.sourceforge.pmd.jaxen.AttributeAxisIterator to net.sourceforge.pmd.lang.ast.xpath.AttributeAxisIterator Renamed - net.sourceforge.pmd.jaxen.DocumentNavigator to net.sourceforge.pmd.lang.ast.xpath.DocumentNavigator Renamed - net.sourceforge.pmd.jaxen.NodeIterator to net.sourceforge.pmd.lang.ast.xpath.NodeIterator Renamed - net.sourceforge.pmd.ast.* into net.sourceforge.pmd.lang.java.ast.* Renamed - net.sourceforge.pmd.rules.* into net.sourceforge.pmd.lang.java.rule.* and updated to follow conventions Renamed - net.sourceforge.pmd.jsp.ast.* into net.sourceforge.pmd.lang.jsp.ast.* Renamed - net.sourceforge.pmd.jsp.rules.* into net.sourceforge.pmd.lang.jsp.ast.rule.* and updated to follow conventions Deleted - net.sourceforge.pmd.cpd.cppast.* into net.sourceforge.pmd.lang.cpp.ast.* Deleted - net.sourceforge.pmd.CommonAbstractRule Deleted - net.sourceforge.pmd.SourceType Deleted - net.sourceforge.pmd.SourceTypeDiscoverer Deleted - net.sourceforge.pmd.SourceTypeToRuleLanguageMapper Deleted - net.sourceforge.pmd.TargetJDK1_3 Deleted - net.sourceforge.pmd.TargetJDK1_4 Deleted - net.sourceforge.pmd.TargetJDK1_5 Deleted - net.sourceforge.pmd.TargetJDK1_6 Deleted - net.sourceforge.pmd.TargetJDK1_7 Deleted - net.sourceforge.pmd.TargetJDKVersion Deleted - net.sourceforge.pmd.sourcetypehandlers.SourceTypeHandlerBroker Deleted - net.sourceforge.pmd.ast.JavaCharStream Deleted - net.sourceforge.pmd.ast.CharStream Deleted - net.sourceforge.pmd.ast.TokenMgrError Deleted - net.sourceforge.pmd.jsp.ast.JspCharStream Deleted - net.sourceforge.pmd.jsp.ast.TokenMgrError API Change - Generalize RuleViolation treatment Renamed - net.sourceforge.pmd.IRuleViolation to net.sourceforge.pmd.RuleViolation Renamed - net.sourceforge.pmd.RuleViolation to net.sourceforge.pmd.lang.rule.AbstractRuleViolation Added - net.sourceforge.pmd.RuleViolationComparator Added - net.sourceforge.pmd.lang.java.rule.JavaRuleViolation Added - net.sourceforge.pmd.lang.jsp.rule.JspRuleViolation API Change - Generalize DFA treatment Renamed - net.sourceforge.pmd.dfa.IDataFlowNode to net.sourceforge.pmd.dfa.DataFlowNode Renamed - net.sourceforge.pmd.dfa.DataFlowNode to net.sourceforge.pmd.dfa.AbstractDataFlowNode Added - net.sourceforge.pmd.ast.JavaDataFlowNode API Change - Generalize AST treatment Added - net.sourceforge.pmd.lang.ast.Node (interface extracted from old Node/SimpleNode) Added - net.sourceforge.pmd.lang.ast.AbstractNode Added - net.sourceforge.pmd.ast.DummyJavaNode Added - net.sourceforge.pmd.jsp.ast.AbstractJspNode Added - net.sourceforge.pmd.jsp.ast.JspNode Renamed - net.sourceforge.pmd.ast.SimpleJavaNode to net.sourceforge.pmd.ast.AbstractJavaNode Renamed - net.sourceforge.pmd.ast.SimpleJavaTypeNode to net.sourceforge.pmd.ast.AbstractJavaTypeNode Renamed - net.sourceforge.pmd.ast.SimpleJavaAccessNode to net.sourceforge.pmd.ast.AbstractJavaAccessNode Renamed - net.sourceforge.pmd.ast.SimpleJavaAccessTypeNode to net.sourceforge.pmd.ast.AbstractJavaAccessTypeNode Deleted - net.sourceforge.pmd.ast.Node Deleted - net.sourceforge.pmd.ast.SimpleNode Deleted - net.sourceforge.pmd.ast.AccessNodeInterface Deleted - net.sourceforge.pmd.jsp.ast.Node Deleted - net.sourceforge.pmd.jsp.ast.SimpleNode New features: New Language 'xml' added, for writting XPathRules against XML documents Other changes: '41' and '42' shortcuts for rulesets added The default Java version processed by PMD is now uniformly Java 1.5. RuleViolations in Reports now uses List internally, and RuleViolationComparator is no longer broken TokenManager errors now include a file name whenever possible for every AST in PMD Added file encoding option to CPD GUI, which already existed for the command line and Ant Fixed bug 1932242 - EmptyMethodInAbstractClassShouldBeAbstract false + Fixed bug 1928009 - Error using migration ruleset in PMD 4.2 Fixed bug 1808110 - PreserveStackTrace ruleset.dtd and ruleset_xml_schema.xsd added to jar file in rulesets directory bin and java14/bin scripts: retroweaver version was not correct in java14/bin scripts support for extra languages in cpd.sh standard unix scripts can be used with cygwin AvoidDuplicateLiteralRule now has 'skipAnnotations' boolean property Fixed false positive in UnusedImports: javadoc comments are parsed to check @see and other tags Fixed parsing bug: constant fields in annotation classes Bug fix: NPE in MoreThanOneLogger UnnecessaryParentheses now checks all expressions, not just return statements New rules: Coupling ruleset: LoosePackageCoupling Controversial ruleset: DotNoPrefixMethodParameters Controversial ruleset: OneDeclarationByLine Naming ruleset: ShortClassName March 25, 2008 - 4.2: Fixed bug 1920155 - CheckResultSet: Does not pass for loop conditionals March 21, 2008 - 4.2rc2: Fixed bug 1912831 - False + UnusedPrivateMethod with varargs Fixed bug 1913536 - Rule Designer does not recognize JSP(XML) Add -auxclasspath option for specifying Type Resolution classpath from command line and auxclasspath nested element for ant task. Fixed formatting problems in loggers. Ant task upgrade: Added a new attribute 'maxRuleCount' to indicate whether or not to fail the build if PMD finds that much violations. March 07, 2008 - 4.2rc1: Fixed bug 1866198 - PMD should not register global Logger Fixed bug 1843273 - False - on SimplifyBooleanReturns Fixed bug 1848888 - Fixed false positive in UseEqualsToCompareStrings Fixed bug 1874313 - Documentation bugs Fixed bug 1855409 - False + in EmptyMethodInAbstractClassShouldBeAbstract Fixed bug 1888967 - Updated xpath query to detect more "empty" methods. Fixed bug 1891399 - Check for JUnit4 test method fails Fixed bug 1894821 - False - for Test Class without Test Cases Fixed bug 1882457 - PositionLiteralsFirstInComparisons rule not working OK Fixed bug 1842505 - XML output incorrect for inner classes Fixed bug 1808158 - Constructor args could also be final Fixed bug 1902351 - AvoidReassigningParameters not identify parent field Fixed other false positives in EmptyMethodInAbstractClassShouldBeAbstract Fixed other issues in SimplifyBooleanReturns Modified AvoidReassigningParameter to also check constructor arguments for reassignement New rules: Basic ruleset: AvoidMultipleUnaryOperators Controversial ruleset: DoNotCallGarbageCollectionExplicitly Design ruleset : ReturnEmptyArrayRatherThanNull,TooFewBranchesForASwitchStatement,AbstractClassWithoutAnyMethod Codesize : TooManyMethods StrictExceptions : DoNotThrowExceptionInFinally Strings : AvoidStringBufferField Rule upgrade: CyclomaticComplexity now can be configured to display only class average complexity or method complexity, or both. Designer upgrade: A new panel for symbols and a tooltips on AST node that displays line, column and access node attributes (private, static, abstract,...) 1.7 added as a valid option for targetjdk. New elements under : to match files exclude from processing, with to override. Rules can now be written which produce violations based upon aggregate file processing (i.e. cross/multiple file violations). PMD Rule Designer can now shows Symbol Table contents for the selected AST node. PMD Rule Designer shows position info in tooltip for AST nodes and highlights matching code for selected AST node in code window. CPD Ant task will report to System.out when 'outputFile' not given. RuleSetWriter class can be used to Serialize a RuleSet to XML in a standard fashion. Recommend PMD IDE plugins standardize their behavior. retroweaver updated to version 2.0.5. November 17, 2007 - 4.1: Fixed annotation bug: ClassCastException when a formal parameter had multiple annotations Added a Visual Studio renderer for CPD; just use "--format vs". Dependencies updates: asm to 3.1, retroweaver to 2.0.2, junit to 4.4 new ant target ("regress") to test regression bugs only November 01, 2007 - 4.1rc1: New rules: Basic ruleset: AvoidUsingHardCodedIP,CheckResultSet Controversial ruleset: AvoidFinalLocalVariable,AvoidUsingShortType,AvoidUsingVolatile,AvoidUsingNativeCode,AvoidAccessibilityAlteration Design ruleset: ClassWithOnlyPrivateConstructorsShouldBeFinal,EmptyMethodInAbstractClassShouldBeAbstract Imports ruleset: TooManyStaticImports J2ee ruleset: DoNotCallSystemExit, StaticEJBFieldShouldBeFinal,DoNotUseThreads Strings ruleset: UseEqualsToCompareStrings Fixed bug 674394 - fixed false positive in DuplicateImports for disambiguation import Fixed bug 631681 - fixed false positive in UnusedPrivateField when field is accessed by outer class Fixed bug 985989 - fixed false negative in ConstructorCallsOverridableMethod for inner static classes Fixed bug 1409944 - fixed false positive in SingularField for lock objects Fixed bug 1472195 - fixed false positives in PositionLiteralsFirstInComparisons when the string is used as a parameter Fixed bug 1522517 - fixed false positive in UselessOverridingMethod for clone method Fixed bug 1744065 - fixed false positive in BooleanInstantiation when a custom Boolean is used Fixed bug 1765613 - fixed NullPointerException in CloneMethodMustImplementCloneable when checking enum Fixed bug 1740480 - fixed false positive in ImmutableField when the assignment is inside an 'if' Fixed bug 1702782 - fixed false positive in UselessOperationOnImmutable when an Immutable on which an operation is performed is compareTo'd Fixed bugs 1764288/1744069/1744071 - When using Type Resolution all junit test cases will notice if you're using an extended TestCase Fixed bug 1793215 - pmd-nicerhtml.xsl does not display line numbers Fixes bug 1796928 - fixed false positive in AvoidThrowingRawExceptionTypes, when a Type name is the same as a RawException. Fixed bug 1811506 - False - : UnusedFormalParameter (property "checkall" needs to be set) Fixed false negative in UnnecessaryCaseChange The Java 1.5 source code parser is now the default for testcode used in PMD's unit tests. Added TypeResolution to the XPath rule. Use typeof function to determine if a node is of a particular type Adding a GenericLiteralChecker, a generic rule that require a regex as property. It will log a violation if a Literal is matched by the regex. See the new rule AvoidUsingHardCodedIP for an example. Adding support for multiple line span String in CPD's AbstractTokenizer, this may change, for the better, CPD's Ruby parsing. This release adds 'nicehtml', with the plan for the next major release to make nicehtml->html, and html->oldhtml. This feature uses an XSLT transformation, default stylesheet maybe override with '-xslt filename'. New CPD command line feature : Using more than one directory for sources. You can now have several '--files' on the command line. SingularField greatly improved to generate very few false positives (none?). Moved from controversial to design. Two options added to restore old behaviour (mostly). Jaxen updated to 1.1.1, now Literal[@Image='""'] works in XPath expressions. July 20, 2007 - 4.0 Fixed bug 1697397 - fixed false positives in ClassCastExceptionWithToArray Fixed bug 1728789 - removed redundant rule AvoidNonConstructorMethodsWithClassName; MethodWithSameNameAsEnclosingClass is faster and does the same thing. July 12, 2007 - 4.0rc2: New rules: Typeresolution ruleset: SignatureDeclareThrowsException - re-implementation using the new Type Resolution facility (old rule is still available) Fixed bug 1698550 - CloneMethodMustImplementCloneable now accepts a clone method that throws CloneNotSupportedException in a final class Fixed bug 1680568 - The new typeresolution SignatureDeclareThrowsException rule now ignores setUp and tearDown in JUnit 4 tests and tests that do not directly extend TestCase The new typeresolution SignatureDeclareThrowsException rule can now ignore JUnit classes completely by setting the IgnoreJUnitCompletely property Fixed false positive in UselessOperationOnImmutable PMD now defaults to using a Java 1.5 source code parser. June 22, 2007 - 4.0rc1: New rules: Strict exception ruleset: DoNotExtendJavaLangError Basic JSP ruleset: JspEncoding J2EE ruleset: MDBAndSessionBeanNamingConvention, RemoteSessionInterfaceNamingConvention, LocalInterfaceSessionNamingConvention, LocalHomeNamingConvention, RemoteInterfaceNamingConvention Optimizations ruleset: AddEmptyString Naming: BooleanGetMethodName New rulesets: Migrating To JUnit4: Rules that help move from JUnit 3 to JUnit 4 Fixed bug 1670717 - 'Copy xml to clipboard' menu command now works again in the Designer Fixed bug 1618858 - PMD no longer raises an exception on XPath like '//ConditionalExpression//ConditionalExpression' Fixed bug 1626232 - Commons logging rules (ProperLogger and UseCorrectExceptionLogging) now catch more cases Fixed bugs 1626201 & 1633683 - BrokenNullCheck now catches more cases Fixed bug 1626715 - UseAssertSameInsteadOfAssertTrue now correctly checks classes which contain the null constant Fixed bug 1531216 - ImmutableField. NameOccurrence.isSelfAssignment now recognizes this.x++ as a self assignment Fixed bug 1634078 - StringToString now recognizes toString on a String Array, rather than an element. Fixed bug 1631646 - UselessOperationOnImmutable doesn't throw on variable.method().variable. Fixed bug 1627830 - UseLocaleWithCaseConversions now works with compound string operations Fixed bug 1613807 - DontImportJavaLang rule allows import to Thread inner classes Fixed bug 1637573 - The PMD Ant task no longer closes System.out if toConsole is set Fixed bug 1451251 - A new UnusedImports rule, using typeresolution, finds unused import on demand rules Fixed bug 1613793 - MissingSerialVersionUID rule now doesn't fire on abstract classes Fixed bug 1666646 - ImmutableField rule doesn't report against volatile variables Fixed bug 1693924 - Type resolution now works for implicit imports Fixed bug 1705716 - Annotation declarations now trigger a new scope level in the symbol table. Fixed bug 1743938 - False +: InsufficientStringBufferDeclaration with multiply Fixed bug 1657957 - UseStringBufferForStringAppends now catches self-assignments Applied patch 1612455 - RFE 1411022 CompareObjectsWithEquals now catches the case where comparison is against new Object Implemented RFE 1562230 - Added migration rule to check for instantiation of Short/Byte/Long Implemented RFE 1627581 - SuppressWarnings("unused") now suppresses all warnings in unusedcode.xml XPath rules are now chained together for an extra speedup in processing PMD now requires JDK 1.5 to be compiled. Java 1.4 support is provided using Retroweaver - PMD will still analyze code from earlier JDKs - to run pmd with 1.4, use the files from the java14 directory (weaved pmd jar and support files) TypeResolution now looks at some ASTName nodes. Memory footprint reduced: most renderers now use less memory by generating reports on the fly. Ant task now takes advantage of multithreading code and on the fly renderers Ant task now logs more debug info when using -verbose PMD command line now has -benchmark: output a benchmark report upon completion; default to System.err December 19, 2006 - 3.9: New rules: Basic ruleset: BigIntegerInstantiation, AvoidUsingOctalValues Codesize ruleset: NPathComplexity, NcssTypeCount, NcssMethodCount, NcssConstructorCount Design ruleset: UseCollectionIsEmpty Strings ruleset: StringBufferInstantiationWithChar Typeresolution ruleset: Loose Coupling - This is a re-implementation using the new Type Resolution facility Fixed bug 1610730 - MisplacedNullCheck now catches more cases Fixed bug 1570915 - AvoidRethrowingException no longer reports a false positive for certain nested exceptions. Fixed bug 1571324 - UselessStringValueOf no longer reports a false positive for additive expressions. Fixed bug 1573795 - PreserveStackTrace doesn't throw CastClassException on exception with 0 args Fixed bug 1573591 - NonThreadSafeSingleton doesn't throw NPE when using this keyword Fixed bug 1371753 - UnnecessaryLocalBeforeReturn is now less aggressive in its reporting. Fixed bug 1566547 - Annotations with an empty MemberValueArrayInitializer are now parsed properly. Fixed bugs 1060761 / 1433119 & RFE 1196954 - CloseResource now takes an optional parameter to identify closure methods Fixed bug 1579615 - OverrideBothEqualsAndHashcode no longer throws an Exception on equals methods that don't have Object as a parameter type. Fixed bug 1580859 - AvoidDecimalLiteralsInBigDecimalConstructor now catches more cases. Fixed bug 1581123 - False +: UnnecessaryWrapperObjectCreation. Fixed bug 1592710 - VariableNamingConventions no longer reports false positives on certain enum declarations. Fixed bug 1593292 - The CPD GUI now works with the 'by extension' option selected. Fixed bug 1560944 - CPD now skips symlinks. Fixed bug 1570824 - HTML reports generated on Windows no longer contain double backslashes. This caused problems when viewing those reports with Apache. Fixed bug 1031966 - Re-Implemented CloneMethodMustImplementCloneable as a typeresolution rule. This rule can now detect super classes/interfaces which are cloneable Fixed bug 1571309 - Optional command line options may be used either before or after the mandatory arguments Applied patch 1551189 - SingularField false + for initialization blocks Applied patch 1573981 - false + in CloneMethodMustImplementCloneable Applied patch 1574988 - false + in OverrideBothEqualsAndHashcode Applied patch 1583167 - Better test code management. Internal JUnits can now be written in XML's Applied patch 1613674 - Support classpaths with spaces in pmd.bat Applied patch 1615519 - controversial/DefaultPackage XPath rule is wrong Applied patch 1615546 - Added option to command line to write directly to a file Implemented RFE 1566313 - Command Line now takes minimumpriority attribute to filter out rulesets PMD now requires JDK 1.4 to run - PMD will still analyze code from earlier JDKs - PMD now uses the built-in JDK 1.4 regex utils vs Jakarta ORO - PMD now uses the JDK javax.xml APIs rather than being hardcoded to use Xerces and Xalan SummaryHTML Report changes from Brent Fisher - now contains linePrefix to support source output from javadoc using "linksource" Fixed CSVRenderer - had flipped line and priority columns Fixed bug in Ant task - CSV reports were being output as text. Fixed false negatives in UseArraysAsList. Fixed several JDK 1.5 parsing bugs. Fixed several rules (exceptions on jdk 1.5 and jdk 1.6 source code). Fixed array handling in AvoidReassigningParameters and UnusedFormalParameter. Fixed bug in UselessOverridingMethod: false + when adding synchronization. Fixed false positives in LocalVariableCouldBeFinal. Fixed false positives in MethodArgumentCouldBeFinal. Modified annotation suppression to use @SuppressWarning("PMD") to suppress all warnings and @SuppressWarning("PMD.UnusedLocalVariable") to suppress a particular rule's warnings. Rules can now call RuleContext.getSourceType() if they need to make different checks on JDK 1.4 and 1.5 code. CloseResource rule now checks code without java.sql import. ArrayIsStoredDirectly rule now checks Constructors undo/redo added to text areas in Designer. Better 'create rule XML' panel in Designer. use of entrySet to iterate over Maps. 1.6 added as a valid option for targetjdk. PMD now allows rules to use Type Resolution. This was referenced in patch 1257259. Renderers use less memory when generating reports. New DynamicXPathRule class to speed up XPath based rules by providing a base type for the XPath expression. Multithreaded processing on multi core or multi cpu systems. Performance Refactoring, XPath rules re-written as Java: AssignmentInOperand AvoidDollarSigns DontImportJavaLang DontImportSun MoreThanOneLogger SuspiciousHashcodeMethodName UselessStringValueOf October 4, 2006 - 3.8: New rules: Basic ruleset: BrokenNullCheck Strict exceptions ruleset: AvoidRethrowingException Optimizations ruleset: UnnecessaryWrapperObjectCreation Strings ruleset: UselessStringValueOf Fixed bug 1498910 - AssignmentInOperand no longer has a typo in the message. Fixed bug 1498960 - DontImportJavaLang no longer reports static imports of java.lang members. Fixed bug 1417106 - MissingBreakInSwitch no longer flags stmts where every case has either a return or a throw. Fixed bug 1412529 - UncommentedEmptyConstructor no longer flags private constructors. Fixed bug 1462189 - InsufficientStringBufferDeclaration now resets when it reaches setLength the same way it does at a Constructor Fixed bug 1497815 - InsufficientStringBufferDeclaration rule now takes the length of the constructor into account, and adds the length of the initial string to its initial length Fixed bug 1504842 - ExceptionSignatureDeclaration no longer flags methods starting with 'test'. Fixed bug 1516728 - UselessOverridingMethod no longer raises an NPE on methods that use generics. Fixed bug 1522054 - BooleanInstantiation now detects instantiations inside method calls. Fixed bug 1522056 - UseStringBufferForStringAppends now flags appends which occur in static initializers and constructors Fixed bug 1526530 - SingularField now finds fields which are hidden at the method or static level Fixed bug 1529805 - UnusedModifier no longer throws NPEs on JDK 1.5 enums. Fixed bug 1531593 - UnnecessaryConversionTemporary no longer reports false positives when toString() is invoked inside the call to 'new Long/Integer/etc()'. Fixed bug 1512871 - Improved C++ tokenizer error messages - now they include the filename. Fixed bug 1531152 - CloneThrowsCloneNotSupportedException now reports the proper line number. Fixed bug 1531236 - IdempotentOperations reports fewer false positives. Fixed bug 1544564 - LooseCoupling rule now checks for ArrayLists Fixed bug 1544565 - NonThreadSafeSingleton now finds if's with compound statements Fixed bug 1561784 - AbstractOptimizationRule no longer throws ClassCastExceptions on certain postfix expressions. Fixed a bug in AvoidProtectedFieldInFinalClass - it no longer reports false positives for protected fields in inner classes. Fixed a bug in the C++ grammar - the tokenizer now properly recognizes macro definitions which are followed by a multiline comment. Modified C++ tokenizer to use the JavaCC STATIC option; this results in about a 30% speedup in tokenizing. Implemented RFE 1501850 - UnusedFormalParameter now catches cases where a parameter is assigned to but not used. Applied patch 1481024 (implementing RFE 1490181)- NOPMD messages can now be reported with a user specified msg, e.g., //NOPMD - this is expected Added JSP support to the copy/paste detector. Placed JSF/JSP ruleset names in rulesets/jsprulesets.properties Added the image to the ASTEnumConstant nodes. Added new XSLT stylesheet for CPD XML->HTML from Max Tardiveau. Refactored UseIndexOfChar to extract common functionality into AbstractPoorMethodCall. Improved CPD GUI and Designer look/functionality; thanks to Brian Remedios for the changes! Rewrote the NOPMD mechanism to collect NOPMD markers as the source file is tokenized. This eliminates an entire scan of each source file. Applied patch from Jason Bennett to enhance CyclomaticComplexity rule to account for conditional or/and nodes, do stmts, and catch blocks. Applied patch from Xavier Le Vourch to reduce false postives from CloneMethodMustImplementCloneable. Updated Jaxen library to beta 10. Performance Refactoring, XPath rules re-written as Java: BooleanInstantiation UselessOperationOnImmutable OverrideBothEqualsAndHashcode UnnecessaryReturn UseStringBufferForStringAppends SingularField NonThreadSafeSingleton June 1, 2006 - 3.7: New rules: Basic-JSP ruleset: DuplicateJspImport Design ruleset: PreserveStackTrace J2EE ruleset: UseProperClassLoader Implemented RFE 1462019 - Add JSPs to Ant Task Implemented RFE 1462020 - Add JSPs to Designer Fixed bug 1461426 InsufficientStringBufferDeclaration does not consider paths Fixed bug 1462184 False +: InsufficientStringBufferDeclaration - wrong size Fixed bug 1465574 - UnusedPrivateMethod no longer reports false positives when a private method is called from a method with a parameter of the same name. Fixed bug 1114003 - UnusedPrivateMethod no longer reports false positives when two methods have the same name and number of arguments but different types. The fix causes PMD to miss a few valid cases, but, c'est la vie. Fixed bug 1472843 - UnusedPrivateMethod no longer reports false positives when a private method is only called from a method that contains a variable with the same name as that method. Fixed bug 1461442 - UseAssertSameInsteadOfAssertTrue now ignores comparisons to null; UseAssertNullInsteadOfAssertTrue will report those. Fixed bug 1474778 - UnnecessaryCaseChange no longer flags usages of toUpperCase(Locale). Fixed bug 1423429 - ImmutableField no longer reports false positives on variables which can be set via an anonymous inner class that is created in the constructor. Fixed major bug in CPD; it was not picking up files other than .java or .jsp. Fixed a bug in CallSuperInConstructor; it now checks inner classes/enums more carefully. Fixed a bug in VariableNamingConventions; it was not setting the warning message properly. Fixed bug in C/C++ parser; a '$' is now allowed in an identifier. This is useful in VMS. Fixed a symbol table bug; PMD no longer crashes on enumeration declarations in the same scope containing the same field name Fixed a bug in ASTVariableDeclaratorId that triggered a ClassCastException if a annotation was used on a parameter. Added RuleViolation.getBeginColumn()/getEndColumn() Added an optional 'showSuppressed' item to the Ant task; this is false by default and toggles whether or not suppressed items are shown in the report. Added an IRuleViolation interface and modified various code classes (include Renderer implementations and Report) to use it. Modified JJTree grammar to use conditional node descriptors for various expression nodes and to use node suppression for ASTModifier nodes; this replaces a bunch of DiscardableNodeCleaner hackery. It also fixed bug 1445026. Modified C/CPP grammar to only build the lexical analyzer; we're not using the parser for CPD, just the token manager. This reduces the PMD jar file size by about 50 KB. March 29, 2006 - 3.6: New rules: Basic ruleset: AvoidThreadGroup Design ruleset: UnsynchronizedStaticDateFormatter Strings ruleset: InefficientEmptyStringCheck, InsufficientStringBufferDeclaration JUnit ruleset: SimplifyBooleanAssertion Basic-JSF ruleset: DontNestJsfInJstlIteration Basic-JSP ruleset: NoLongScripts, NoScriptlets, NoInlineStyleInformation, NoClassAttribute, NoJspForward, IframeMissingSrcAttribute, NoHtmlComments Fixed bug 1414985 - ConsecutiveLiteralAppends now checks for intervening references between appends. Fixed bug 1418424 - ConsecutiveLiteralAppends no longer flags appends in separate methods. Fixed bug 1416167 - AppendCharacterWithChar now catches cases involving escaped characters. Fixed bug 1421409 - Ant task now has setter to allow minimumPriority attribute to be used. Fixed bug 1416164 - InefficientStringBuffering no longer reports false positives on the three argument version of StringBuffer.append(). Fixed bug 1415326 - JUnitTestsShouldContainAsserts no longer errors out on JDK 1.5 generics. Fixed bug 1415333 - CyclomaticComplexity no longer errors out on JDK 1.5 enums. Fixed bug 1415663 - PMD no longer fails to parse abstract classes declared in a method. Fixed bug 1433439 - UseIndexOfChar no longer reports false positives on case like indexOf('a' + getFoo()). Fixed bug 1435218 - LoggerIsNotStaticFinal no longer reports false positives for local variables. Fixed bug 1413745 - ArrayIsStoredDirectly no longer reports false positives for array deferences. Fixed bug 1435751 - Added encoding type of UTF-8 to the CPD XML file. Fixed bug 1441539 - ConsecutiveLiteralAppends no longer flags appends() involving method calls. Fixed bug 1339470 - PMD no longer fails to parse certain non-static initializers. Fixed bug 1425772 - PMD no longer fails with errors in ASTFieldDeclaration when parsing some JDK 1.5 code. Fixed bugs 1448123 and 1449175 - AvoidFieldNameMatchingTypeName, SingularField, TooManyFields, and AvoidFieldNameMatchingMethodName no longer error out on enumerations. Fixed bug 1444654 - migrating_to_14 and migrating_to_15 no longer refer to rule tests. Fixed bug 1445231 - TestClassWithoutTestCases: no longer flags abstract classes. Fixed bug 1445765 - PMD no longer uses huge amounts of memory. However, you need to use RuleViolation.getBeginLine(); RuleViolation.getNode() is no more. Fixed bug 1447295 - UseNotifyAllInsteadOfNotify no longer flags notify() methods that have a parameter. Fixed bug 1455965 - MethodReturnsInternalArray no longer flags variations on 'return new Object[] {}'. Implemented RFE 1415487 - Added a rulesets/releases/35.xml ruleset (and similar rulesets for previous releases) contains rules new to PMD v3.5 Wouter Zelle fixed a false positive in NonThreadSafeSingleton. Wouter Zelle fixed a false positive in InefficientStringBuffering. The CPD Ant task now supports an optional 'language' attribute. Removed some ill-advised casts from the parsers. Fixed bug in CallSuperInConstructor; it no longer flag classes without extends clauses. Fixed release packaging; now entire xslt/ directory contents are included. Added more XSLT from Dave Corley - you can use them to filter PMD reports by priority level. You can now access the name of a MemberValuePair node using getImage(). PositionLiteralsFirstInComparisons was rewritten in XPath. Added a getVersionString method to the TargetJDKVersion interface. Added an option '--targetjdk' argument to the Benchmark utility. Applied a patch from Wouter Zelle to clean up the Ant Formatter class, fix a TextRenderer bug, and make toConsole cleaner. Rewrote AvoidCallingFinalize in Java; fixed bug and runs much faster, too. Uploaded ruleset schema to http://pmd.sf.net/ruleset_xml_schema.xsd UseIndexOfChar now catches cases involving lastIndexOf. Rules are now run in the order in which they're listed in a ruleset file. Internally, they're now stored in a List vs a Set, and RuleSet.getRules() now returns a Collection. Upgraded to JUnit version 3.8.2. Jan 25, 2006 - 3.5: New rules: Basic ruleset: UselessOperationOnImmutable, MisplacedNullCheck, UnusedNullCheckInEquals Migration ruleset: IntegerInstantiation JUnit ruleset: UseAssertNullInsteadOfAssertTrue Strings ruleset: AppendCharacterWithChar, ConsecutiveLiteralAppends, UseIndexOfChar Design ruleset: AvoidConstantsInterface Optimizations ruleset: UseArraysAsList, AvoidArrayLoops Controversial ruleset: BooleanInversion Fixed bug 1371980 - InefficientStringBuffering no longer flags StringBuffer methods other than append(). Fixed bug 1277373 - InefficientStringBuffering now catches more cases. Fixed bug 1376760 - InefficientStringBuffering no longer throws a NullPointerException when processing certain expressions. Fixed bug 1371757 - Misleading example in AvoidSynchronizedAtMethodLevel Fixed bug 1373510 - UseAssertSameInsteadOfAssertTrue no longer has a typo in its message, and its message is more clear. Fixed bug 1375290 - @SuppressWarnings annotations are now implemented correctly; they accept one blank argument to suppress all warnings. Fixed bug 1376756 - UselessOverridingMethod no longer throws an exception on overloaded methods. Fixed bug 1378358 - StringInstantiation no longer throws ClassCastExceptions on certain allocation patterns. Fixed bug 1371741 - UncommentedEmptyConstructor no longer flags constructors that consist of a this() or a super() invocation. Fixed bug 1277373 - InefficientStringBuffering no longer flags concatenations that involve a static final String. Fixed bug 1379701 - CompareObjectsWithEquals no longer flags comparisons of array elements. Fixed bug 1380969 - UnusedPrivateMethod no longer flags private static methods that are only invoked in a static context from a field declaration. Fixed bug 1384594 - Added a 'prefix' property for BeanMembersShouldSerializeRule Fixed bug 1394808 - Fewer missed hits for AppendCharacterWithChar and InefficientStringBuffering, thanks to Allan Caplan for catching these Fixed bug 1400754 - A NPE is no longer thrown on certain JDK 1.5 enum usages. Partially fixed bug 1371753 - UnnecessaryLocalBeforeReturn message now reflects the fact that that rule flags all types Fixed a bug in UseStringBufferLength; it no longers fails with an exception on expressions like StringBuffer.toString.equals(x) Fixed a bug in CPD's C/C++ parser so that it no longer fails on multi-line literals; thx to Tom Judge for the nice patch. CPD now recognizes '--language c' and '--language cpp' as both mapping to the C/C++ parser. Modified renderers to support disabling printing of suppressed warnings. Introduced a new AbstractRenderer class that all Renderers can extends to get the current behavior - that is, suppressed violations are printed. Implemented RFE 1375435 - you can now embed regular expressions inside XPath rules, i.e., //ClassOrInterfaceDeclaration[matches(@Image, 'F?o')]. Added current CLASSPATH to pmd.bat. UnusedFormalParameter now catches unused constructor parameters, and its warning message now reflects whether it caught a method or a constructor param. Rebuilt JavaCC parser with JavaCC 4.0. Added jakarta-oro-2.0.8.jar as a new dependency to support regular expression in XPath rules. Ant task now supports a 'minimumPriority' attribute; only rules with this priority or higher will be run. Renamed Ant task 'printToConsole' attribute to 'toConsole' and it can only be used inside a formatter element. Added David Corley's Javascript report, more details are here: http://tomcopeland.blogs.com/juniordeveloper/2005/12/demo_of_some_ni.html November 30, 2005 - 3.4: New rules: Basic ruleset: ClassCastExceptionWithToArray, AvoidDecimalLiteralsInBigDecimalConstructor Design ruleset: NonThreadSafeSingleton, UncommentedEmptyMethod, UncommentedEmptyConstructor Controversial ruleset: DefaultPackage Naming ruleset: MisleadingVariableName Migration ruleset: ReplaceVectorWithList, ReplaceHashtableWithMap, ReplaceEnumerationWithIterator, AvoidEnumAsIdentifier, AvoidAssertAsIdentifier Strings ruleset: UseStringBufferLength Fixed bug 1292745 - Removed unused source file ExceptionTypeChecking.java Fixed bug 1292609 - The JDK 1.3 parser now correctly handles certain 'assert' usages. Also added a 'JDK 1.3' menu item to the Designer. Fixed bug 1292689 - Corrected description for UnnecessaryLocalBeforeReturn Fixed bug 1293157 - UnusedPrivateMethod no longer reports false positives for private methods which are only invoked from static initializers. Fixed bug 1293277 - Messages that used 'pluginname' had duplicated messages. Fixed bug 1291353 - ASTMethodDeclaration isPublic/isAbstract methods always return true. The syntactical modifier - i.e., whether or not 'public' was used in the source code in the method declaration - is available via 'isSyntacticallyPublic' and 'isSyntacticallyAbstract' Fixed bug 1296544 - TooManyFields no longer checks the wrong property value. Fixed bug 1304739 - StringInstantiation no longer crashes on certain String constructor usages. Fixed bug 1306180 - AvoidConcatenatingNonLiteralsInStringBuffer no longer reports false positives on certain StringBuffer usages. Fixed bug 1309235 - TooManyFields no longer includes static finals towards its count. Fixed bug 1312720 - DefaultPackage no longer flags interface fields. Fixed bug 1312754 - pmd.bat now handles command line arguments better in WinXP. Fixed bug 1312723 - Added isSyntacticallyPublic() behavior to ASTFieldDeclaration nodes. Fixed bug 1313216 - Designer was not displaying 'final' attribute for ASTLocalVariableDeclaration nodes. Fixed bug 1314086 - Added logging-jakarta-commons as a short name for rulesets/logging-jakarta-commons.xml to SimpleRuleSetNameMapper. Fixed bug 1351498 - Improved UnnecessaryCaseChange warning message. Fixed bug 1351706 - CompareObjectsWithEquals now catches more cases. Fixed bug 1277373 (and 1347286) - InefficientStringBuffering now flags fewer false positives. Fixed bug 1363447 - MissingBreakInSwitch no longer reports false positives for switch statements where each switch label has a return statement. Fixed bug 1363458 - MissingStaticMethodInNonInstantiatableClass no longer reports cases where there are public static fields. Fixed bug 1364816 - ImmutableField no longer reports false positives for fields assigned in an anonymous inner class in a constructor. Implemented RFE 1311309 (and 1119854) - Suppressed RuleViolation counts are now included in the reports. Implemented RFE 1220371 - Rule violation suppression via annotations. Per the JLS, @SuppressWarnings can be placed before the following nodes: TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE. Implemented RFE 1275547 - OverrideBothEqualsAndHashcode now skips Comparator implementations. Applied patch 1306999 - Renamed CloseConnection to CloseResource and added support for checking Statement and ResultSet objects. Applied patch 1344754 - EmptyCatchBlock now skips catch blocks that contain comments. This is also requested in RFE 1347884. Renamed AvoidConcatenatingNonLiteralsInStringBuffer to InefficientStringBuffering; new name is a bit more concise. Modified LongVariable; now it has a property which can be used to override the minimum reporting value. Improved CPD XML report. CPD no longer skips header files when checking C/C++ code. Reworked CPD command line arguments; old-style arguments will still work for one more version, though. Lots of documentation improvements. September 15, 2005 - 3.3: New rules: Design: PositionLiteralsFirstInComparisons, UnnecessaryLocalBeforeReturn Logging-jakarta-commons: ProperLogger Basic: UselessOverridingMethod Naming: PackageCase, NoPackage Strings: UnnecessaryCaseChange Implemented RFE 1220171 - rule definitions can now contain a link to an external URL for more information on that rule - for example, a link to the rule's web page. Thanks to Wouter Zelle for designing and implementing this! Implemented RFE 1230685 - The text report now includes parsing errors even if no rule violations are reported Implemented RFE 787860 - UseSingleton now accounts for JUnit test suite declarations. Implemented RFE 1097090 - The Report object now contains the elapsed time for running PMD. This shows up in the XML report as an elapsedTime attribute in the pmd element in the format '2m 5s' or '1h 5h 35s' or '25s' . Implemented RFE 1246338 - CPD now handles SCCS directories and NTFS junction points. Fixed bug 1226858 - JUnitAssertionsShouldIncludeMessage now checks calls to assertFalse. Fixed bug 1227001 - AvoidCallingFinalize no longer flags calls to finalize() within finalizers. Fixed bug 1229755 - Fixed typo in ArrayIsStoredDirectly description. Fixed bug 1229749 - Improved error message when an external rule is not found. Fixed bug 1224849 - JUnitTestsShouldContainAsserts no longer skips method declarations which include explicit throws clauses. Fixed bug 1225492 - ConstructorCallsOverridableMethod now reports the correct method name. dvholten's examples in RFE 1235562 also helped with this a great deal. Fixed bug 1228589 - DoubleCheckedLocking and ExceptionSignatureDeclaration no longer throw ClassCastExceptions on method declarations that declare generic return types. Fixed bug 1235299 - NullAssignment no longer flags null equality comparisons in ternary expressions. Fixed bug 1235300 - NullAssignment no longer flags assignments to final fields. Fixed bug 1240201 - The UnnecessaryParentheses message is no longer restricted to return statements. Fixed bug 1242290 - The JDK 1.5 parser no longer chokes on nested enumerations with a constructor. Fixed bug 1242544 - SimplifyConditional no longer flags null checks that precede an instanceof involving an array dereference. Fixed bug 1242946 - ArrayIsStoredDirectly no longer reports false positives for equality expression comparisons. As a bonus, its message now includes the variable name :-) Fixed bug 1232648 - MethodReturnsInternalArray no longer reports false positives on return statement expressions that involve method invocations on an internal array. Fixed bug 1244428 - MissingStaticMethodInNonInstantiatableClass no longer reports warnings for nested classes. Some inner class cases will be missed, but false positives will be eliminated as well. Fixed bug 1244443 - EqualsNull now catches more cases. Fixed bug 1250949 - The JDK 1.5 parser no longer chokes on annotated parameters and annotated local variables. Fixed bug 1245139 - TooManyFields no longer throws a ClassCastException when processing anonymous classes. Fixed bug 1251256 - ImmutableField no longer skips assignments in try blocks on methods (which led to false positives). Fixed bug 1250949 - The JDK 1.5 parser no longer chokes on AnnotationTypeMemberDeclaration with a default value. Fixed bug 1245367 - ImmutableField no longer triggers on assignments in loops in constructors. Fixed bug 1251269 - AvoidConcatenatingNonLiteralsInStringBuffer no longer triggers on StringBuffer constructors like 'new StringBuffer(1 + getFoo());' Fixed bug 1244570 - AvoidConcatenatingNonLiteralsInStringBuffer no longer triggers on certain AST patterns involving local variable declarations inside Statement nodes. Fixed bug 695344 - StringInstantiation no longer triggers on the String(byte[]) constructor. Fixed bug 1114754 - UnusedPrivateMethod reports fewer false positives. Fixed bug 1290718 - Command line parameter documentation is now correct for targetjdk options. Applied patch 1228834 - XPath rules can now use properties to customize rules. Thanks to Wouter Zelle for another great piece of work! Fixed a bug in RuleSetFactory that missed some override cases; thx to Wouter Zelle for the report and a fix. Fixed a bug in the grammar that didn't allow constructors to have type parameters, which couldn't parse some JDK 1.5 constructs. Fixed a bug in ImportFromSamePackage; now it catches the case where a class has an on-demand import for the same package it is in. Fixed a bug in CompareObjectsWithEquals; now it catches some local variable cases. Fixed a bug in CouplingBetweenObjects; it no longer triggers an exception (which is a bug in the symbol table layer) by calling getEnclosingClassScope() when the node in question isn't enclosed by one. Moved AvoidCallingFinalize from the design ruleset to the finalize ruleset and then deleted redundant ExplicitCallToFinalize rule from the finalize ruleset. Deleted redundant ExceptionTypeChecking rule from the strictexception ruleset; use AvoidInstanceofChecksInCatchClause in the design ruleset instead. Added some new XSLT scripts that create nifty HTML output; thanks to Wouter Zelle for the code. Improved UseCorrectExceptionLogging; thx to Wouter Zelle for the new XPath. Improved warning message from UnusedPrivateMethod. Improved EmptyIfStmt; now it catches the case where an IfStatement is followed by an EmptyStatement node. The Ant task now accepts the short names of rulesets (e.g., unusedcode for rulesets/unusedcode.xml). Removed unnecessary '.html' suffix from displayed filenames when the linkPrefix attribute is used with the HTML renderer. Added an optional 'description' attribute to the 'property' element in the ruleset XML files. Added a simplified SimpleNode.addViolation() method to reduce duplicated rule violation creation code. Moved from jaxen-1.0-fcs.jar/saxpath-1.0-fcs.jar to jaxen-1.1-beta-7.jar. This yielded a 20% speed increase in the basic ruleset! June 21, 2005 - 3.2: New rules: UseCorrectExceptionLogging (logging-jakarta-commons ruleset), AvoidPrintStackTrace (logging-java ruleset), CompareObjectsWithEquals (design ruleset) Fixed bug 1201577 - PMD now correctly parses method declarations that return generic types. Fixed bug 1205709 - PMD no longer takes a long time to report certain parsing errors. Fixed bug 1052356 - ImmutableField no longer triggers on fields which are assigned to in a constructor's try statement. Fixed bug 1215854 - Package/class/method names are now filled in whenever possible, and the XML report includes all three. Fixed bug 1209719 - MethodArgumentCouldBeFinal no longer triggers on arguments which are modified using postfix or prefix expressions. A bug in AvoidReassigningParameters was also fixed under the same bug id. Fixed bug 1188386 - MethodReturnsInternalArray no longer flags returning a local array declaration. Fixed bug 1172137 - PMD no longer locks up when generating a control flow graph for if statements with labelled breaks. Fixed bug 1221094 - JUnitTestsShouldContainAsserts no longer flags static methods. Fixed bug 1217028 - pmd.bat now correctly passes parameters to PMD. Implemented RFE 1188604 - AvoidThrowingCertainExceptionTypes has been split into AvoidThrowingRawExceptionTypes and AvoidThrowingNullPointerException. Implemented RFE 1188369 - UnnecessaryBooleanAssertion now checks for things like 'assertTrue(!foo)'. These should be changed to 'assertFalse(foo)' for clarity. Implemented RFE 1199622 - UnusedFormalParameter now defaults to only checking private methods unless a 'checkall' property is set. Implemented RFE 1220314 - the symbol table now includes some rudimentary type information. Break and continue statement labels (if present) are placed in the image field. Fixed bug which caused MissingSerialVersionUID to trigger on all interfaces that implemented other interfaces. Modified NullAssignmentRule to catch null assignments in ternary expressions. Added two new node types - ASTCatchStatement and ASTFinallyStatement. Modified rule XML definition; it no longer includes a symboltable attribute since the symbol table layer is now run for all files analyzed. Harden equality of AbstractRule and RuleSet objects (needed for the Eclipse plugin features) Change RuleSet.getRuleByName. Now return null instead of throwing a RuntimeException when the rule is not found Add .project and .classpath to the module so that it can be checkout as an Eclipse project May 10, 2005 - 3.1: New rules: SimplifyStartsWith, UnnecessaryParentheses, CollapsibleIfStatements, UseAssertEqualsInsteadOfAssertTrue, UseAssertSameInsteadOfAssertTrue, UseStringBufferForStringAppends, SimplifyConditional, SingularField Fixed bug 1170535 - LongVariable now report variables longer than 17 characters, not 12. Fixed bug 1182755 - SystemPrintln no longer overreports problems. Fixed bug 1188372 - AtLeastOneConstructor no longer fires on interfaces. Fixed bug 1190508 - UnnecessaryBooleanAssertion no longer fires on nested boolean literals. Fixed bug 1190461 - UnusedLocal no longer misses usages which are on the RHS of a right bit shift operator. Fixed bug 1188371 - AvoidInstantiatingObjectsInLoops no longer fires on instantiations in loops when the 'new' keyword is preceded by a 'return' or a 'throw'. Fixed bug 1190526 - TooManyFields now accepts a property setting correctly, and default lower bound is 15 vs 10. Fixed bug 1196238 - UnusedImports no longer reports false positives for various JDK 1.5 java.lang subpackages. Fixed bug 1169731 - UnusedImports no longer reports false positives on types used inside generics. This bug also resulted in a bug in ForLoopShouldBeWhileLoop being fixed, thanks Wim! Fixed bug 1187325 - UnusedImports no longer reports a false positive on imports which are used inside an Annotation. Fixed bug 1189720 - PMD no longer fails to parse generics that use 'member selectors'. Fixed bug 1170109 - The Ant task now supports an optional 'targetjdk' attribute that accepts values of '1.3', '1.4', or '1.5'. Fixed bug 1183032 - The XMLRenderer no longer throws a SimpleDateFormat exception when run with JDK 1.3. Fixed bug 1097256 - The XMLRenderer now supports optional encoding of UTF8 characters using the 'net.sourceforge.pmd.supportUTF8' environment variable. Fixed bug 1198832 - AbstractClassWithoutAbstractMethod no longer flags classes which implement interfaces since these can partially implement the interface and thus don't need to explicitly declare abstract methods. Implemented RFE 1193979 - BooleanInstantiation now catches cases like Boolean.valueOf(true) Implemented RFE 1171095 - LabeledStatement nodes now contain the image of the label. Implemented RFE 1176401 - UnusedFormalParameter now flags public methods. Implemented RFE 994338 - The msg produced by ConstructorCallsOverridableMethod now includes the offending method name. Modified command line parameters; removed -jdk15 and -jdk13 parameters and added a -'targetjdk [1.3|1.4|1.5]' parameter. Modified CSVRenderer to include more columns. Optimized rules: FinalFieldCouldBeStatic (115 seconds to 7 seconds), SuspiciousConstantFieldName (48 seconds to 14 seconds), UnusedModifer (49 seconds to 4 seconds) March 23, 2005 - 3.0: New rules: MissingSerialVersionUID, UnnecessaryFinalModifier, AbstractClassDoesNotContainAbstractMethod, MissingStaticMethodInNonInstantiatableClass, AvoidSynchronizedAtMethodLevel, AvoidCallingFinalize, UseNotifyAllInsteadOfNotify, MissingBreakInSwitch, AvoidInstanceofChecksInCatchClause, AvoidFieldNameMatchingTypeName, AvoidFieldNameMatchingMethodName, AvoidNonConstructorMethodsWithClassName, TestClassWithoutTestCases, TooManyFields, CallSuperInConstructor, UnnecessaryBooleanAssertion, UseArrayListInsteadOfVector Implemented RFE 1058039 - PMD's command line interface now accepts abbreviated names for the standard rulesets; for example 'java net.sourceforge.pmd.PMD /my/source/code/ text basic,unusedcode' would run the rulesets/basic.xml and the rulesets/unusedcode.xml rulesets on the source in /my/source/code and produce a text report. Implemented RFE 1119851 - PMD's Ant task now supports an 'excludeMarker' attribute. Fixed bug 994400 - False +: ConstructorCallsOverridableMethodRule, thanks to ereissner for reporting it Fixed bug 1146116 - JUnitTestsShouldIncludeAssert no longer crashes on inner Interface Fixed bug 1114625 - UnusedPrivateField no longer throws an NPE on standalone postfix expressions which are prefixed with 'this'. Fixed bug 1114020 - The Ant task now reports a complete stack trace when run with the -verbose flag. Fixed bug 1117983 - MethodArgumentCouldBeFinal no longer reports false positives on try..catch blocks. Fixed bug 797742 - PMD now parses JDK 1.5 source code. Note that it's not perfect yet; more testing/bug reports are welcome! Fixed a bug - the StatisticalRule no longer 'merges' data points when using the 'topscore' property. Fixed a bug - the PMD Ant task's failOnRuleViolation attribute no longer causes a BuildException in the case when no rule violations occur. Modified the XSLT to add a summary section. Added Ruby support to CPD. Optimized various rules and wrote a benchmarking application; results are here - http://infoether.com/~tom/pmd_timing.txt February 1, 2005 - 2.3: Fixed bug 1113927 - ExceptionAsFlowControl no longer throws NPEs on code where a throw statement exists without a try statement wrapping it. Fixed bug 1113981 - AvoidConcatenatingNonLiteralsInStringBuffer no longer throws NPEs on code where an append appears as a child of an ExplicitConstructorInvocation node. Fixed bug 1114039 - AvoidInstantiatingObjectsInLoops's message no longer contains a spelling error. Fixed bug 1114029 - The 'optimization' rules no longer throw NPEs at various points. Fixed bug 1114251 - The 'sunsecure' rules no longer throw NPEs at various points. January 31, 2005 - 2.2: New rules: LocalVariableCouldBeFinal, MethodArgumentCouldBeFinal, AvoidInstantiatingObjectsInLoops, ArrayIsStoredDirectly, MethodReturnsInternalArray, AssignmentToNonFinalStatic, AvoidConcatenatingNonLiteralsInStringBuffer Fixed bug 1088459 - JUnitTestsShouldContainAsserts no longer throws ClassCastException on interface, native, and abstract method declarations. Fixed bug 1100059 - The Ant task now generates a small empty-ish report if there are no violations. Implemented RFE 1086168 - PMD XML reports now contain a version and timestamp attribute in the element. Implemented RFE 1031950 - The PMD Ant task now supports nested ruleset tags Fixed a bug in the rule override logic; it no longer requires the "class" attribute of a rule be listed in the overrides section. Added 'ignoreLiterals' and 'ignoreIdentifiers' boolean options to the CPD task. Cleaned up a good bit of the symbol table code; thanks much to Harald Gurres for the patch. CPD now contains a generic copy/paste checker for programs in any language December 15, 2004 - 2.1: New rules: AvoidProtectedFieldInFinalClass, SystemPrintln Fixed bug 1050173 - ImmutableFieldRule no longer reports false positives for static fields. Fixed bug 1050286 - ImmutableFieldRule no longer reports false positives for classes which have multiple constructors only a subset of which set certain fields. Fixed bug 1055346 - ImmutableFieldRule no longer reports false positive on preinc/predecrement/postfix expressions. Fixed bug 1041739 - EmptyStatementNotInLoop no longer reports false positives for nested class declarations in methods. Fixed bug 1039963 - CPD no longer fails to parse C++ files with multi-line macros. Fixed bug 1053663 - SuspiciousConstantFieldName no longer reports false positives for interface members. Fixed bug 1055930 - CouplingBetweenObjectsRule no longer throws a NPE on interfaces Fixed a possible NPE in dfa.report.ReportTree. Implemented RFE 1058033 - Renamed run.[sh|bat] to pmd.[sh|bat]. Implemented RFE 1058042 - XML output is more readable now. Applied patch 1051956 - Rulesets that reference rules using "ref" can now override various properties. Applied patch 1070733 - CPD's Java checker now has an option to ignore both literals and identifiers - this can help find large duplicate code blocks, but can also result in false positives. YAHTMLRenderer no longer has dependence on Ant packages. Modified the AST to correctly include PostfixExpression nodes. Previously a statement like "x++;" was embedded in the parent StatementExpression node. Moved BooleanInstantiation from the design ruleset to the basic ruleset. Updated Xerces libraries to v2.6.2. Many rule names had the word "Rule" tacked on to the end. Various folks thought this was a bad idea, so here are the new names of those rules which were renamed: - basic.xml: UnnecessaryConversionTemporary, OverrideBothEqualsAndHashcode, DoubleCheckedLocking - braces.xml: WhileLoopsMustUseBraces, IfElseStmtsMustUseBraces, ForLoopsMustUseBraces - clone.xml: ProperCloneImplementation - codesize.xml: CyclomaticComplexity, ExcessivePublicCount - controversial.xml: UnnecessaryConstructor, AssignmentInOperand, DontImportSun, SuspiciousOctalEscape - coupling.xml: CouplingBetweenObjects, ExcessiveImports, LooseCoupling - design.xml: UseSingleton, SimplifyBooleanReturns, AvoidReassigningParameters, ConstructorCallsOverridableMethod, AccessorClassGeneration, CloseConnection, OptimizableToArrayCall, IdempotentOperations. ImmutableField - junit.xml: JUnitAssertionsShouldIncludeMessage, JUnitTestsShouldIncludeAssert - logging-java.xml: MoreThanOneLogger, LoggerIsNotStaticFinal - naming.xml: ShortMethodName, VariableNamingConventions, ClassNamingConventions, AbstractNaming - strictexception.xml: ExceptionAsFlowControl, AvoidCatchingNPE, AvoidThrowingCertainExceptionTypes Continued working on JDK 1.5 compatibility - added support for static import statements, varargs, and the new for loop syntax - still TODO: generics and annotations (note that autoboxing shouldn't require a grammar change) - Good article on features: http://java.sun.com/developer/technicalArticles/releases/j2se15/ October 19, 2004 - 2.0: New rules: InstantiationToGetClass, IdempotentOperationsRule, SuspiciousEqualsMethodName, SimpleDateFormatNeedsLocale, JUnitTestsShouldContainAssertsRule, SuspiciousConstantFieldName, ImmutableFieldRule, MoreThanOneLoggerRule, LoggerIsNotStaticFinalRule, UseLocaleWithCaseConversions Applied patch in RFE 992576 - Enhancements to VariableNamingConventionsRule Implemented RFE 995910 - The HTML report can now include links to HTMLlized source code - for example, the HTML generated by JXR. Implemented RFE 665824 - PMD now ignores rule violations in lines containing the string 'NOPMD'. Fixed bug in SimplifyBooleanExpressions - now it catches more cases. Fixed bugs in AvoidDuplicateLiterals - now it ignores small duplicate literals, its message is more helpful, and it catches more cases. Fixed bug 997893 - UnusedPrivateField now detects assignments to members of private fields as a usage. Fixed bug 1020199 - UnusedLocalVariable no longer flags arrays as unused if an assignment is made to an array slot. Fixed bug 1027133 - Now ExceptionSignatureDeclaration skips certain JUnit framework methods. Fixed bug 1008548 - The 'favorites' ruleset no longer contains a broken reference. Fixed bug 1045583 - UnusedModifier now correctly handles anonymous inner classes within interface field declarations. Partially fixed bug 998122 - CloseConnectionRule now checks for imports of java.sql before reporting a rule violation. Applied patch 1001694 - Now PMD can process zip/jar files of source code. Applied patch 1032927 - The XML report now includes the rule priority. Added data flow analysis facade from Raik Schroeder. Added two new optional attributes to rule definitions - symboltable and dfa. These allow the symbol table and DFA facades to be configured on a rule-by-rule basis. Note that if your rule needs the symbol table; you'll need to add symboltable="true" to your rule definition. FWIW, this also results in about a 5% speedup for rules that don't need either layer. Added a "logging" ruleset - thanks to Miguel Griffa for the code! Enhanced the ASTViewer - and renamed it 'Designer' - to display data flows. Moved development environment to Maven 1.0. Moved development environment to Ant 1.6.2. This is nice because using the new JUnit task attribute "forkmode='perBatch'" cuts test runtime from 90 seconds to 7 seconds. Sweet. MethodWithSameNameAsEnclosingClass now reports a more helpful line number. July 14, 2004 - 1.9: New rules: CloneMethodMustImplementCloneable, CloneThrowsCloneNotSupportedException, EqualsNull, ConfusingTernary Created new "clone" ruleset and moved ProperCloneImplementationRule over from the design ruleset. Moved LooseCoupling from design.xml to coupling.xml. Some minor performance optimizations - removed some unnecessary casts from the grammar, simplified some XPath rules. Postfix expressions (i.e., x++) are now available in the grammar. To access them, search for StatementExpressions with an image of "++" or "--" - i.e., in XPath, //StatementExpression[@Image="++"]. This is an odd hack and hopefully will get cleared up later. Ant task and CLI now used BufferedInputStreams. Converted AtLeastOneConstructor rule from Java code to XPath. Implemented RFE 743460: The XML report now contains the ruleset name. Implemented RFE 958714: Private field and local variables that are assigned but not used are now flagged as unused. Fixed bug 962782 - BeanMembersShouldSerializeRule no longer reports set/is as being a violation. Fixed bug 977022 - UnusedModifier no longer reports false positives for modifiers of nested classes in interfaces Fixed bug 976643 - IfElseStmtsMustUseBracesRule no longer reports false positives for certain if..else constructs. Fixed bug 985961 - UseSingletonRule now fires on classes which contain static fields Fixed bug 977031 - FinalizeDoesNotCallSuperFinalize no longer reports a false positive when a finalizer contains a call to super.finalize in a try {} finally {} block. May 19, 2004 - 1.8: New rules: ExceptionAsFlowControlRule, BadComparisonRule, AvoidThrowingCertainExceptionTypesRule, AvoidCatchingNPERule, OptimizableToArrayCallRule Major grammar changes - lots of new node types added, many superfluous nodes removed from the runtime AST. Bug 786611 - http://sourceforge.net/tracker/index.php?func=detail&aid=786611&group_id=56262&atid=479921 - explains it a bit more. Fixed bug 786611 - Expressions are no longer over-expanded in the AST Fixed bug 874284 - The AST now contains tokens for bitwise or expressions - i.e., "|" April 22, 2004 - 1.7: Moved development environment to Maven 1.0-RC2. Fixed bug 925840 - Messages were no longer getting variable names plugged in correctly Fixed bug 919308 - XMLRenderer was still messed up; 'twas missing a quotation mark. Fixed bug 923410 - PMD now uses the default platform character set encoding; optionally, you can pass in a character encoding to use. Implemented RFE 925839 - Added some more detail to the UseSingletonRule. Added an optional 'failuresPropertyName' attribute to the Ant task. Refactored away duplicate copies of XPath rule definitions in regress/, yay! Removed manifest from jar file; it was only there for the Main-class attribute, and it's not very useful now since PMD has several dependencies. Began working on JDK 1.5 compatibility - added support for EnumDeclaration nodes. March 15, 2004 - 1.6: Fixed bug 895661 - XML reports containing error elements no longer have malformed XML. Fixed a bug in UnconditionalIfStatement - it no longer flags things like "if (x==true)". Applied Steve Hawkins' improvements to CPD: - Various optimizations; now it runs about 4 times faster! - fixed "single match per file" bug - tweaked source code slicing - CSV renderer Added two new renderers - SummaryHTMLRenderer and PapariTextRenderer. Moved development environment to Ant 1.6 and JavaCC 3.2. February 2, 2004 - 1.5: New rules: DontImportSunRule, EmptyFinalizer, EmptyStaticInitializer, AvoidDollarSigns, FinalizeOnlyCallsSuperFinalize, FinalizeOverloaded, FinalizeDoesNotCallSuperFinalize, MethodWithSameNameAsEnclosingClass, ExplicitCallToFinalize, NonStaticInitializer, DefaultLabelNotLastInSwitchStmt, NonCaseLabelInSwitchStatement, SuspiciousHashcodeMethodName, EmptyStatementNotInLoop, SuspiciousOctalEscapeRule FinalizeShouldBeProtected moved from design.xml to finalizers.xml. Added isTrue() to ASTBooleanLiteral. Added UnaryExpression to the AST. Added isPackagePrivate() to AccessNode. January 7, 2004 - 1.4: New rules: AbstractNamingRule, ProperCloneImplementationRule Fixed bug 840926 - AvoidReassigningParametersRule no longer reports a false positive when assigning a value to an array slot when the array is passed as a parameter to a method Fixed bug 760520 - RuleSetFactory is less strict about whitespace in ruleset.xml files. Fixed bug 826805 - JumbledIncrementorRule no longer reports a false positive when a outer loop incrementor is used as an array index Fixed bug 845343 - AvoidDuplicateLiterals now picks up cases when a duplicate literal appears in field declarations. Fixed bug 853409 - VariableNamingConventionsRule no longer requires that non-static final fields be capitalized Fixed a bug in OverrideBothEqualsAndHashcodeRule; it no longer reports a false positive when equals() is passed the fully qualified name of Object. Implemented RFE 845348 - UnnecessaryReturn yields more useful line numbers now Added a ruleset DTD and a ruleset XML Schema. Added 'ExplicitExtends' and 'ExplicitImplements' attributes to UnmodifiedClassDeclaration nodes. October 23, 2003 - 1.3: Relicensed under a BSD-style license. Fixed bug 822245 - VariableNamingConventionsRule now handles interface fields correctly. Added new rules: EmptySynchronizedBlock, UnnecessaryReturn ASTType now has an getDimensions() method. October 06, 2003 - 1.2.2: Added new rule: CloseConnectionRule Fixed bug 782246 - FinalFieldCouldBeStatic no longer flags fields in interfaces. Fixed bug 782235 - "ant -version" now prints more details when a file errors out. Fixed bug 779874 - LooseCouplingRule no longer triggers on ArrayList Fixed bug 781393 - VariableNameDeclaration no longer throws ClassCastExpression since ASTLocalVariableDeclaration now subclasses AccessNode Fixed bug 797243 - CPD XML report can no longer contain ]]> (CDEnd) Fixed bug 690196 - PMD now handles both JDK 1.3 and 1.4 code - i.e., usage of "assert" as an identifier. Fixed bug 805092 - VariableNamingConventionsRule no longer flags serialVersionUID as a violation Fixed bug - Specifying a non-existing rule format on the command line no longer results in a ClassNotFoundException. XPath rules may now include pluggable parameters. This feature is very limited. For now. Tweaked CPD time display field Made CPD text fields uneditable Added more error checking to CPD GUI input Added "dialog cancelled" check to CPD "Save" function Added Boris Gruschko's AST viewer. Added Jeff Epstein's TextPad integration. ASTType now has an isArray() method. August 1, 2003 - 1.2.1: Fixed bug 781077 - line number "-1" no longer appears for nodes with siblings. July 30, 2003 - 1.2: Added new rules: VariableNamingConventionsRule, MethodNamingConventionsRule, ClassNamingConventionsRule, AvoidCatchingThrowable, ExceptionSignatureDeclaration, ExceptionTypeChecking, BooleanInstantiation Fixed bug 583047 - ASTName column numbers are now correct Fixed bug 761048 - Symbol table now creates a scope level for anonymous inner classes Fixed bug 763529 - AccessorClassGenerationRule no longer crashes when given a final inner class Fixed bug 771943 - AtLeastOneConstructorRule and UnnecessaryConstructorRule no longer reports false positives on inner classes. Applied patch from Chris Webster to fix another UnnecessaryConstructorRule problem. Added ability to accept a comma-delimited string of files and directories on the command line. Added a CSVRenderer. Added a "-shortfilenames" argument to the PMD command line interface. Modified grammer to provide information on whether an initializer block is static. ASTViewer now shows node images and modifiers ASTViewer now saves last edited text to ~/.pmd_astviewer Moved the PMD Swing UI into a separate module - pmd-swingui. Updated license.txt to point to new location. June 19, 2003 - 1.1: Added new rules: FinalizeShouldBeProtected, FinalFieldCouldBeStatic, BeanMembersShouldSerializeRule Removed "verbose" attribute from PMD and CPD Ant tasks; now they use built in logging so you can do a "ant -verbose cpd" or "ant -verbose pmd". Thanks to Philippe T'Seyen for the code. Added "excludes" feature to rulesets; thanks to Gael Marziou for the suggestion. Removed "LinkedList" from LooseCouplingRule checks; thx to Randall Schulz for the suggestion. CPD now processes PHP code. Added VBHTMLRenderer; thanks to Vladimir Bossicard for the code. Added "Save" item to CPD GUI; thanks to mcclain looney for the patch. Fixed bug 732592 - Ant task now accepts a nested classpath element. Fixed bug 744915 - UseSingletonRule no longer fires on abstract classes, thanks to Pablo Casado for the bug report. Fixed bugs 735396 and 735399 - false positives from ConstructorCallsOverridableMethodRule Fixed bug 752809 - UnusedPrivateMethodRule now catches unused private static methods, thanks to Conrad Roche for the bug report. April 17, 2003 - 1.05: Added new rules: ReturnFromFinallyBlock, SimplifyBooleanExpressions Added a new Ant task for CPD; thanks to Andy Glover for the code. Added ability to specify a class name as a renderer on the command line or in the formatter "type" attribute of the Ant task. Brian Ewins completely rewrote CPD using a portion of the Burrows-Wheeler Transform - it's much, much, much faster now. Rebuilt parser with JavaCC 3.0; made several parser optimizations. The Ant task now accepts a element to aid in loading custom rulesets. Thanks to Luke Francl for the suggestion. Fixed several bugs in UnnecessaryConstructorRule; thanks to Adam Nemeth for the reports and fixes. All test-data classes have been inlined into their respective JUnit tests. March 21, 2003 - 1.04 Added new rules: ConstructorCallsOverridableMethodRule, AtLeastOneConstructorRule, JUnitAssertionsShouldIncludeMessageRule, DoubleCheckedLockingRule, ExcessivePublicCountRule, AccessorClassGenerationRule The Ant task has been updated; if you set "verbose=true" full stacktraces are printed. Thx to Paul Roebuck for the suggestion. Moved JUnit rules into their own package - "net.sourceforge.pmd.rules.junit". Incorporated new ResourceLoader; thanks to Dave Fuller Incorporated new XPath-based rule definitions; thanks to Dan Sheppard for the excellent work. Fixed bug 697187 - Problem with nested ifs Fixed bug 699287 - Grammar bug; good catch by David Whitmore February 11, 2003 - 1.03 Added new rules: CyclomaticComplexityRule, AssignmentInOperandRule Added numbering to the HTMLRenderer; thx to Luke Francl for the code. Added an optional Ant task attribute 'failOnRuleViolation'. This stops the build if any rule violations are found. Added an XSLT script for processing the PMD XML report; thx to Mats for the code. The Ant task now determines whether the formatter toFile attribute is absolute or relative and routes the report appropriately. Moved several rules into a new "controversial" ruleset. Fixed bug 672742 - grammar typo was hosing up ASTConstructorDeclaration which was hosing up UseSingletonRule Fixed bug 674393 - OnlyOneReturn rule no longer counts returns that are inside anonymous inner classes as being inside the containing method. Thx to C. Lamont Gilbert for the bug report. Fixed bug 674420 - AvoidReassigningParametersRule no longer counts parameter field reassignment as a violation. Thx to C. Lamont Gilbert for the bug report. Fixed bug 673662 - The Ant task's "failOnError" attribute works again. Changed the semantics of this attribute, though, so it fails the build if errors occurred. A new attribute 'failOnRuleViolation' serves the purpose of stopping the build if rule violations are found. Fixed bug 676340 - Symbol table now creates new scope level when it encounters a switch statement. See the bug for code details; generally, this bug would have triggered runtime exceptions on certain blocks of code. Fixed bug 683465 - JavaCC parser no longer has ability to throw java.lang.Error; now it only throws java.lang.RuntimeExceptions. Thx to Gunnlaugur Thor Briem for a good discussion on this topic. Fixed bug in OverrideBothEqualsAndHashcodeRule - it no longer bails out with a NullPtrException on interfaces that declare a method signature "equals(Object)". Thx to Don Leckie for catching that. January 22, 2003 - 1.02: Added new rules: ImportFromSamePackageRule, SwitchDensityRule, NullAssignmentRule, UnusedModifierRule, ForLoopShouldBeWhileLoopRule Updated LooseCouplingRule to check for usage of Vector; thx to Vladimir for the good catch. Updated AvoidDuplicateLiteralsRule to report the line number of the first occurrence of the duplicate String. Modified Ant task to use a formatter element; this lets you render a report in several formats without having to rerun PMD. Added a new Ant task attribute - shortFilenames. Modified Ant task to ignore whitespace in the ruleset attribute Added rule priority settings. Added alternate row colorization to HTML renderer. Fixed bug 650623 - the Ant task now uses relative directories for the report file Fixed bug 656944 - PMD no longer prints errors to System.out, instead it just rethrows any exceptions Fixed bug 660069 - this was a symbol table bug; thanks to mcclain looney for the report. Fixed bug 668119 - OverrideBothEqualsAndHashcodeRule now checks the signature on equals(); thanks to mcclain looney for the report. November 07 2002 - 1.01: Fixed bug 633879: EmptyFinallyBlockRule now handles multiple catch blocks followed by a finally block. Fixed bug 633892: StringToStringRule false positive exposed problem in symbol table usage to declaration code. Fixed bug 617971: Statistical rules no longer produce tons of false positives due to accumulated results. Fixed bug 633209: OnlyOneReturn rule no longer requires the return stmt to be the last statement. Enhanced EmptyCatchBlockRule to flag multiple consecutive empty catch blocks. Renamed AvoidStringLiteralsRule to AvoidDuplicateLiteralsRule. Modified Ant task to truncate file paths to make the HTML output neater. November 04 2002 - 1.0: Added new rules: StringToStringRule, AvoidReassigningParametersRule, UnnecessaryConstructorRule, AvoidStringLiteralsRule Fixed bug 631010: AvoidDeeplyNestedIfStmtsRule works correctly with if..else stmts now Fixed bug 631605: OnlyOneReturn handles line spillover now. Moved AvoidDeeplyNestedIfStmts from the braces ruleset to the design ruleset. Moved several rules from the design ruleset to the codesize ruleset. Added a new "favorites" ruleset. October 04 2002 - 1.0rc3: Added new rules: OnlyOneReturnRule, JumbledIncrementerRule, AvoidDeeplyNestedIfStmtsRule PMD is now built and tested with JUnit 3.8.1 and Ant 1.5. Added support for IntelliJ's IDEAJ. Fixed bug 610018 - StringInstantiationRule now allows for String(byte[], int, int) usage. Fixed bug 610693 - UnusedPrivateInstanceVariable handles parameter shadowing better. Fixed bug 616535 - Command line interface input checking is better now. Fixed bug 616615 - Command line interface allows the text renderer to be used now Fixed a bug - the statistics rules now handle interfaces better. September 12 2002 - 1.0rc2: Added new rules: JUnitSpellingRule, JUnitStaticSuiteRule, StringInstantiationRule Added new rulesets - junit, strings. Added a printToConsole attribute to the Ant task so that you can see the report right there in the Ant output. Fixed bug in PMD GUI - rules are now saved correctly. Fixed bug 597916 - CPD line counts are accurate now. September 09 2002 - 1.0rc1: Added new rules: UnusedImportsRule, EmptySwitchStmtRule, SwitchStmtsShouldHaveDefaultRule, IfStmtsMustUseBracesRule Fixed bug 597813 - Rule properties are now parsed correctly Fixed bug 597905 - UseSingletonRule now resets its state correctly Moved several rules into a new ruleset - braces. Improved CPD by removing import statements and package statements from the token set. Added Metrics API to the Report. Updated PMD GUI. August 16 2002 - 0.9: Added new rules: LongParameterListRule, SimplifyBooleanReturnsRule Enhanced statistics rules to support various ways of triggering rule violations Added rule customization via XML parameters Enhanced CopyAndPasteDetector; added a GUI Fixed bug 592060 - UnusedPrivateInstanceVariable handles explicitly referenced statics correctly Fixed bug 593849 - UnusedPrivateInstanceVariable handles nested classes better July 30 2002 - 0.8: Added new rule: UnusedFormalParameterRule Fixed bug 588083 - ForLoopsNeedBraces rule correctly handles a variety of for statement formats Added prototype of the copy and paste detector July 25 2002 - 0.7: Added new rules: UnusedPrivateMethodRule, WhileLoopsMustUseBracesRule, ForLoopsMustUseBracesRule, LooseCouplingRule Fixed bug 583482 - EmptyCatchBlock and EmptyFinallyBlock no longer report an incorrect line number. July 18 2002 - 0.6: Added new rules: ExcessiveClassLength, ExcessiveMethodLength DuplicateImportsRule now reports the correct line number. Fixed bug 582639 - Rule violations are now reported on the proper line Fixed bug 582509 - Removed unneeded throws clause Fixed bug 583009 - Now rulesets.properties is in the jar file July 15 2002 - 0.5: Added new rules: DontImportJavaLangRule, DuplicateImportsRule Added new ruleset: rulesets/imports.xml Changed sorting of RuleViolations to group Files together. Changed XML Renderer to improved format. Created DVSL Stylesheet for the new format. Moved the Cougaar rules out of the PMD core. Fixed bug 580093 - OverrideBothEqualsAndHashcodeRule reports a more correct line number. Fixed bug 581853 - UnusedLocalVariableRule now handles anonymous inner classes correctly. Fixed bug 580278 - this was a side effect of bug 581853. Fixed bug 580123 - UnusedPrivateInstanceVariable now checks for instance variable usage in inner classes. July 10 2002 - 0.4: Added new rules: OverrideBothEqualsAndHashcodeRule, EmptyTryBlock, EmptyFinallyBlock Reports are now sorted by line number RuleSets can now reference rules in other RuleSets Fixed bug 579718 - made 'ruleset not found' error message clearer. July 03 2002 - 0.3: Added new rules: UseSingletonRule, ShortVariableRule, LongVariableRule, ShortMethodNameRule Moved rules into RuleSets which are defined in XML files in the ruleset directory Ant task: -Added a 'failonerror' attribute -Changed 'rulesettype' to 'rulesetfiles' -Removed 'text' report format; only 'html' and 'xml' are available now June 27 2002 - 0.2: Added new rules: IfElseStmtsMustUseBracesRule, EmptyWhileStmtRule Modified command line interface to accept a rule set Fixed bug in EmptyCatchBlockRule Fixed typo in UnnecessaryConversionTemporaryRule Moved Ant task to the net.sourceforge.pmd.ant package Added new HTML report format June 25 2002 - 0.1: Initial release The PMD book - $20 - http://pmdapplied.com/ controversial,basic,strings,design,naming,finalizers,braces,clone,codesize,coupling,imports,javabeans,junit,logging-jakarta-commons,logging-java,migrating,optimizations,strictexception,sunsecure,unusedcode