pmd: Applied patch 3427563 - Deprecated class (android.util.config), kindly provided by Lukas Reschke
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7551 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
parent
e141e7a5f4
commit
843baf888d
@ -162,8 +162,6 @@ options.pmd.rules.PositionLiteralsFirstInComparisons=false
|
||||
options.pmd.rules.PreserveStackTrace=false
|
||||
options.pmd.rules.ProperCloneImplementation=false
|
||||
options.pmd.rules.ProperLogger=false
|
||||
options.pmd.rules.ProtectLogD=false
|
||||
options.pmd.rules.ProtectLogV=false
|
||||
options.pmd.rules.RemoteInterfaceNamingConvention=false
|
||||
options.pmd.rules.RemoteSessionInterfaceNamingConvention=false
|
||||
options.pmd.rules.ReplaceEnumerationWithIterator=false
|
||||
|
@ -417,6 +417,7 @@ Fixed bug 2904832 - Type resolution not working for ASTType when using an inner
|
||||
Fixed bug 1435751 - XML format does not support UTF-8
|
||||
Fixed bug 3303811 - Deadlink on "Similar projects" page
|
||||
Fixed bug 3017616 - Updated documentation regarding Netbeans plugin - thanks to Jesse Glick
|
||||
Fixed bug 3427563 - Deprecated class (android.util.config) - thanks to Lukas Reschke for the patch
|
||||
|
||||
ruleset.dtd and ruleset_xml_schema.xsd added to jar file in rulesets directory
|
||||
bin and java14/bin scripts:
|
||||
|
@ -31,13 +31,7 @@ To get better results, make sure that the auxclasspath is defined for type resol
|
||||
@Image='onStart'
|
||||
]]
|
||||
/Block[not(
|
||||
(BlockStatement[1]/Statement/StatementExpression/PrimaryExpression/PrimaryPrefix[@Image= ancestor::MethodDeclaration/MethodDeclarator/@Image]) or
|
||||
((BlockStatement[1]/Statement/IfStatement/Expression[
|
||||
PrimaryExpression/PrimaryPrefix/Name[@Image='Config.LOGD' or @Image='Config.LOGV']
|
||||
or
|
||||
ConditionalAndExpression/PrimaryExpression/PrimaryPrefix/Name[@Image='Config.LOGD' or @Image='Config.LOGV']
|
||||
]) and
|
||||
(BlockStatement[2]/Statement/StatementExpression/PrimaryExpression/PrimaryPrefix[@Image= ancestor::MethodDeclaration/MethodDeclarator/@Image])))]
|
||||
(BlockStatement[1]/Statement/StatementExpression/PrimaryExpression/PrimaryPrefix[@Image= ancestor::MethodDeclaration/MethodDeclarator/@Image]))]
|
||||
[ancestor::ClassOrInterfaceDeclaration[//ClassOrInterfaceType[
|
||||
typeof(@Image, 'android.app.Activity', 'Activity') or
|
||||
typeof(@Image, 'android.app.Application', 'Application') or
|
||||
@ -100,78 +94,6 @@ public class DummyActivity extends Activity {
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="ProtectLogD"
|
||||
since="4.2.5" language="java"
|
||||
message="Log.d calls should be protected by checking Config.LOGD first"
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="http://pmd.sourceforge.net/rules/java/android.html#ProtectLogD">
|
||||
<description>Log.d calls should be protected by checking Config.LOGD first</description>
|
||||
<priority>3</priority>
|
||||
<properties>
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//PrimaryPrefix/Name[@Image='Log.d']
|
||||
[not(ancestor::IfStatement/Expression[
|
||||
PrimaryExpression/PrimaryPrefix/Name[@Image='Config.LOGD']
|
||||
or
|
||||
ConditionalAndExpression/PrimaryExpression/PrimaryPrefix/Name[@Image='Config.LOGD']
|
||||
])]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
</properties>
|
||||
<example>
|
||||
<![CDATA[
|
||||
public class DummyActivity extends Activity {
|
||||
public void foo() {
|
||||
Log.d("TAG", "msg1"); // call at this point not recommended
|
||||
|
||||
anyMethod();
|
||||
|
||||
if (Config.LOGD) Log.d("TAG", "msg1"); // preferred placement
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="ProtectLogV"
|
||||
since="4.2.5" language="java"
|
||||
message="Log.v calls should be protected by checking Config.LOGV first"
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="http://pmd.sourceforge.net/rules/java/android.html#ProtectLogV">
|
||||
<description>Log.v calls should be protected by checking Config.LOGV first</description>
|
||||
<priority>3</priority>
|
||||
<properties>
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//PrimaryPrefix/Name[@Image='Log.v']
|
||||
[not(ancestor::IfStatement/Expression[
|
||||
PrimaryExpression/PrimaryPrefix/Name[@Image='Config.LOGV']
|
||||
or
|
||||
ConditionalAndExpression/PrimaryExpression/PrimaryPrefix/Name[@Image='Config.LOGV']
|
||||
])]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
</properties>
|
||||
<example>
|
||||
<![CDATA[
|
||||
public class DummyActivity extends Activity {
|
||||
public void foo() {
|
||||
Log.v("TAG", "msg1"); // call at this point not recommended
|
||||
|
||||
anyMethod();
|
||||
|
||||
if (Config.LOGV) Log.v("TAG", "msg1"); // preferred placement
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</example>
|
||||
</rule>
|
||||
|
||||
<rule name="DoNotHardCodeSDCard"
|
||||
since="4.2.6" language="java"
|
||||
message="Do not hardcode /sdcard."
|
||||
|
@ -22,8 +22,6 @@ This ruleset contains links to rules that are new in PMD v5.0
|
||||
|
||||
<rule ref="rulesets/java/android.xml/CallSuperFirst"/>
|
||||
<rule ref="rulesets/java/android.xml/CallSuperLast"/>
|
||||
<rule ref="rulesets/java/android.xml/ProtectLogD"/>
|
||||
<rule ref="rulesets/java/android.xml/ProtectLogV"/>
|
||||
<rule ref="rulesets/java/basic.xml/CheckSkipResult"/>
|
||||
<rule ref="rulesets/java/basic.xml/ExtendsObject"/>
|
||||
<rule ref="rulesets/java/controversial.xml/AvoidPrefixingMethodParameters"/>
|
||||
@ -38,7 +36,7 @@ This ruleset contains links to rules that are new in PMD v5.0
|
||||
<rule ref="rulesets/java/empty.xml/EmptyInitializer"/>
|
||||
<rule ref="rulesets/java/empty.xml/EmptyStatementBlock"/>
|
||||
<rule ref="rulesets/java/imports.xml/UnnecessaryFullyQualifiedName"/>
|
||||
<rule ref="rulesets/java/junit.xml/JUnitTestContainsTooManyAsserts"/>
|
||||
<rule ref="rulesets/java/junit.xml/JUnitTestContainsTooManyAsserts"/>
|
||||
<rule ref="rulesets/java/junit.xml/UseAssertTrueInsteadOfAssertEquals"/>
|
||||
<rule ref="rulesets/java/logging-jakarta-commons.xml/GuardDebugLogging"/>
|
||||
<rule ref="rulesets/java/naming.xml/ShortClassName"/>
|
||||
@ -47,8 +45,8 @@ This ruleset contains links to rules that are new in PMD v5.0
|
||||
<rule ref="rulesets/java/strictexception.xml/AvoidCatchingGenericException"/>
|
||||
<rule ref="rulesets/java/strictexception.xml/AvoidThrowingNewInstanceOfSameException"/>
|
||||
<rule ref="rulesets/java/unnecessary.xml/UselessParentheses"/>
|
||||
|
||||
|
||||
<rule ref="rulesets/xml/basic.xml/MistypedCDATASection"/>
|
||||
|
||||
|
||||
</ruleset>
|
||||
|
||||
|
@ -14,8 +14,6 @@ public class AndroidRulesTest extends SimpleAggregatorTst {
|
||||
addRule(RULESET, "CallSuperFirst");
|
||||
addRule(RULESET, "CallSuperLast");
|
||||
addRule(RULESET, "DoNotHardCodeSDCard");
|
||||
addRule(RULESET, "ProtectLogD");
|
||||
addRule(RULESET, "ProtectLogV");
|
||||
}
|
||||
|
||||
public static junit.framework.Test suite() {
|
||||
|
@ -17,26 +17,23 @@ public class MyActivity extends Activity {
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Success, first statement is enclosed in Config.LOGD or LOGV
|
||||
Success
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class MyActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(final Bundle state) {
|
||||
if (Config.LOGD) { Log.d("Tag", "msg 1"); }
|
||||
super.onCreate(state);
|
||||
foo();
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
if (Config.LOGV) { Log.v("Tag", "msg 1"); }
|
||||
super.onResume();
|
||||
foo();
|
||||
}
|
||||
@Override
|
||||
protected void onStart() {
|
||||
if (booleanValue && Config.LOGD) { Log.d("Tag", "msg 1"); }
|
||||
super.onStart();
|
||||
foo();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user