Allow java.lang.invoke. imports in the DontImportJavaLangRule
This commit is contained in:
1 parent
d1a6dc1130
commit
2fe1271788
2 files changed
+10
-1
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ public class DontImportJavaLangRule extends AbstractJavaRule {
|
||||
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.ProcessBuilder.")) {
|
||||
|| img.startsWith("java.lang.ProcessBuilder.") || img.startsWith("java.lang.invoke.")) {
|
||||
return data;
|
||||
}
|
||||
addViolation(data, node);
|
||||
|
||||
+9
@@ -61,6 +61,15 @@ public class Foo {}
|
||||
<code><![CDATA[
|
||||
import java.lang.ProcessBuilder.Redirect;
|
||||
|
||||
public class Foo {}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>import java.lang.invoke.MethodHandles: #1031 false DontImportJavaLang</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
import java.lang.invoke.MethodHandles;
|
||||
|
||||
public class Foo {}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
Reference in new issue
Block a user