pmd: #1031 false DontImportJavaLang

This commit is contained in:
Andreas Dangel
2012-10-21 19:57:51 +02:00
parent d1d4fca5d5
commit ce8a166a11
3 changed files with 12 additions and 1 deletions

View File

@ -41,6 +41,7 @@ Fixed bug 1025: Regression of Crash in PMDTask due to multithreading (Eclipse an
Fixed bug 1017: Type resolution very slow for big project. Thanks to Roman for the patch.
Fixed bug 1036: Documentation: default threshold values removed from v5.0
Fixed bug 1035: UseObjectForClearerAPI has misspelled message
Fixed bug 1031: false DontImportJavaLang
Improved JSP parser to be less strict with not valid XML documents (like HTML). Thanks to Victor Bucutea.
Fixed bgastviewer not working. Thanks to Victor Bucutea.

View File

@ -23,7 +23,8 @@ public class DontImportJavaLangRule extends AbstractJavaRule {
if (img.startsWith("java.lang")) {
if (img.startsWith("java.lang.ref") || img.startsWith("java.lang.reflect")
|| img.startsWith("java.lang.annotation") || img.startsWith("java.lang.instrument")
|| img.startsWith("java.lang.management") || img.startsWith("java.lang.Thread.")) {
|| img.startsWith("java.lang.management") || img.startsWith("java.lang.Thread.")
|| img.startsWith("java.lang.ProcessBuilder.")) {
return data;
}
addViolation(data, node);

View File

@ -55,4 +55,13 @@ import java.lang.Thread.UncaughtExceptionHandler;
public class Foo {}
]]></code>
</test-code>
<test-code>
<description>import java.lang.ProcessBuilder.Redirect: #1031 false DontImportJavaLang</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.lang.ProcessBuilder.Redirect;
public class Foo {}
]]></code>
</test-code>
</test-data>