????, 2006 - 3.6: New rules: Basic ruleset: AvoidThreadGroup Design ruleset: UnsynchronizedStaticDateFormatter Strings ruleset: InefficientEmptyStringCheck, InsufficientStringBufferDeclaration 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 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. Implemented RFE 1415487 - Added a rulesets/releases/35.xml ruleset (and similar rulesets for previous releases) contains rules new to PMD v3.5 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. PositionLiteralsFirstInComparisons was rewritten in XPath. Added a getVersionString method to the TargetJDKVersion interface. Added an option '--targetjdk' argument to the Benchmark utility. 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. ***** TODO: remove deprecated printToConsole element from PMDTask 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. 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 Using PMD? Get the book! http://pmdapplied.com/