diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt index 3b2ac54dbb..d24e9b194d 100644 --- a/pmd/etc/changelog.txt +++ b/pmd/etc/changelog.txt @@ -3,6 +3,9 @@ Add options --ignore-literals and --ignore-identifiers to the CPD command line task, thanks to Cd-Man Fixed character reference in xml report - thanks to Seko +New Rule: + basic: DontCallThreadRun - thanks to Andy Throgmorton + September 14, 2011 - 4.2.6: Fixed bug 2920057 - False + : CloseRessource whith an external getter Fixed bug 1808110 - Fixed performance issue on PreserveStackTrace diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/basic/BasicRulesTest.java b/pmd/regress/test/net/sourceforge/pmd/rules/basic/BasicRulesTest.java index f0f42c1db1..9d113b1ba5 100644 --- a/pmd/regress/test/net/sourceforge/pmd/rules/basic/BasicRulesTest.java +++ b/pmd/regress/test/net/sourceforge/pmd/rules/basic/BasicRulesTest.java @@ -45,6 +45,7 @@ public class BasicRulesTest extends SimpleAggregatorTst { addRule("basic", "UnnecessaryConversionTemporary"); addRule("basic", "UselessOperationOnImmutable"); addRule("basic", "UselessOverridingMethod"); + addRule("basic", "DontCallThreadRun"); } public static junit.framework.Test suite() { diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/basic/xml/DontCallThreadRun.xml b/pmd/regress/test/net/sourceforge/pmd/rules/basic/xml/DontCallThreadRun.xml new file mode 100644 index 0000000000..6ce4ed27c6 --- /dev/null +++ b/pmd/regress/test/net/sourceforge/pmd/rules/basic/xml/DontCallThreadRun.xml @@ -0,0 +1,30 @@ + + + + + 1 + + + + + 1 + + + diff --git a/pmd/rulesets/basic.xml b/pmd/rulesets/basic.xml index 482726ec6f..3228327722 100644 --- a/pmd/rulesets/basic.xml +++ b/pmd/rulesets/basic.xml @@ -1211,7 +1211,7 @@ public class Test { @@ -1240,6 +1240,41 @@ public class Foo { ]]> - + + +Explicitly calling Thread.run() method will execute in the caller's thread of control. Instead, call Thread.start() for the intended behavior. + + 4 + + + + + + + + + + + -