diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt index b5625b8ee2..f3799ae254 100644 --- a/pmd/etc/changelog.txt +++ b/pmd/etc/changelog.txt @@ -21,6 +21,7 @@ New rule: Android: DoNotHardCodeSDCard Controversial : AvoidLiteralsInIfCondition (patch 2591627), UseConcurrentHashMap StrictExceptions : AvoidCatchingGenericException, AvoidLosingExceptionInformation + Naming : GenericsNaming February 08, 2009 - 4.2.5: diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/naming/NamingRulesTest.java b/pmd/regress/test/net/sourceforge/pmd/rules/naming/NamingRulesTest.java index 5babe69fea..9ce2520fcf 100644 --- a/pmd/regress/test/net/sourceforge/pmd/rules/naming/NamingRulesTest.java +++ b/pmd/regress/test/net/sourceforge/pmd/rules/naming/NamingRulesTest.java @@ -26,6 +26,7 @@ public class NamingRulesTest extends SimpleAggregatorTst { addRule("naming", "SuspiciousEqualsMethodName"); addRule("naming", "SuspiciousHashcodeMethodName"); addRule("naming", "VariableNamingConventions"); + addRule("naming", "GenericsNaming"); } public static junit.framework.Test suite() { diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/naming/xml/GenericsNaming.xml b/pmd/regress/test/net/sourceforge/pmd/rules/naming/xml/GenericsNaming.xml new file mode 100644 index 0000000000..bd698a9416 --- /dev/null +++ b/pmd/regress/test/net/sourceforge/pmd/rules/naming/xml/GenericsNaming.xml @@ -0,0 +1,47 @@ + + + + + 0 + +{ +} + ]]> + + + + 0 + +{ +} + ]]> + + + + 1 + +{ +} + ]]> + + + + 1 + +{ +} + ]]> + + diff --git a/pmd/rulesets/naming.xml b/pmd/rulesets/naming.xml index 2eef174ddc..b4318421b0 100644 --- a/pmd/rulesets/naming.xml +++ b/pmd/rulesets/naming.xml @@ -507,4 +507,53 @@ public boolean getFoo(boolean bar); // ok, unless checkParameterizedMethods=true ]]> + + +Generics names should be a one letter long and upper case. + + 4 + + + + 1 + or + string:upper-case(@Image) != @Image +] +]]> + + + + + extends BaseDao +{ + // This is ok... +} + +public interface GenericDao +{ + // Also this +} + +public interface GenericDao +{ + // 'e' should be an 'E' +} + +public interface GenericDao +{ + // 'EF' is not ok. +} + + + + ]]> + +