Merge branch 'issue-1546'
Closes #133 PR has been rebased for 5.4.x/5.5.x/master
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -40,4 +40,20 @@ public class ImportsRulesTest extends SimpleAggregatorTst {
|
||||
public enum ENUM2 {
|
||||
C, D;
|
||||
}
|
||||
|
||||
// Do not delete these two classes - it is needed for a test case
|
||||
// see: /pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/imports/xml/UnnecessaryFullyQualifiedName.xml
|
||||
// #1546 part 1 UnnecessaryFullyQualifiedName doesn't take into consideration conflict resolution
|
||||
// #1546 part 2 UnnecessaryFullyQualifiedName doesn't take into consideration conflict resolution
|
||||
public static class PhonyMockito {
|
||||
public static <T> T mock(Class<T> clazz) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PhonyPowerMockito {
|
||||
public static <T> T mock(Class<T> clazz) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -323,14 +323,44 @@ public class InitialPageComponent extends BaseExecutionCourseComponent {
|
||||
<description>#1436 UnnecessaryFullyQualifiedName false positive on clashing static imports with enums</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
import net.sourceforge.pmd.lang.java.rule.imports.ImportsRulesTest.ENUM2;
|
||||
import static net.sourceforge.pmd.lang.java.rule.imports.ImportsRulesTest.ENUM1.*;
|
||||
import static net.sourceforge.pmd.lang.java.rule.imports.ImportsRulesTest.ENUM2.*;
|
||||
|
||||
public class UnnecessaryFullyQualifiedName {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(ENUM1.values());
|
||||
System.out.println(A);
|
||||
System.out.println(D);
|
||||
System.out.println(ENUM2.values());
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#1546 part 1 UnnecessaryFullyQualifiedName doesn't take into consideration conflict resolution</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
import net.sourceforge.pmd.lang.java.rule.imports.ImportsRulesTest.PhonyMockito;
|
||||
import static net.sourceforge.pmd.lang.java.rule.imports.ImportsRulesTest.PhonyMockito.*;
|
||||
import static net.sourceforge.pmd.lang.java.rule.imports.ImportsRulesTest.PhonyPowerMockito.*;
|
||||
|
||||
public class Foo {
|
||||
private Bar bar = Mockito.mock(Bar.class); // doing simply mock(Bar.class) is ambiguous (compile error)
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#1546 part 2 UnnecessaryFullyQualifiedName doesn't take into consideration conflict resolution</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
import net.sourceforge.pmd.lang.java.rule.imports.ImportsRulesTest.PhonyMockito;
|
||||
import static net.sourceforge.pmd.lang.java.rule.imports.ImportsRulesTest.PhonyMockito.*;
|
||||
import static net.sourceforge.pmd.lang.java.rule.imports.ImportsRulesTest.PhonyPowerMockito.mock;
|
||||
|
||||
public class Foo {
|
||||
private Bar bar = Mockito.mock(Bar.class); // doing simply mock(Bar.class) would use a differen method than intended
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
@ -37,6 +37,7 @@
|
||||
* [#129](https://github.com/pmd/pmd/pull/129): \[plsql] Added correct parse of IS [NOT] NULL and multiline DML
|
||||
* [#130](https://github.com/pmd/pmd/pull/130); \[core] Reduce thread contention
|
||||
* [#131](https://github.com/pmd/pmd/pull/131): \[core] Make RuleSetFactory immutable
|
||||
* [#133](https://github.com/pmd/pmd/pull/133): \[java] UnnecessaryFullyQualifiedName can detect conflicts
|
||||
* [#135](https://github.com/pmd/pmd/pull/135): \[apex] New ruleset for Apex security
|
||||
|
||||
**Bugfixes:**
|
||||
@ -45,6 +46,8 @@
|
||||
* [#1542](https://sourceforge.net/p/pmd/bugs/1542/): \[java] CPD throws an NPE when parsing enums with -ignore-identifiers
|
||||
* apex-apexunit
|
||||
* [#1543](https://sourceforge.net/p/pmd/bugs/1543/): \[apex] ApexUnitTestClassShouldHaveAsserts assumes APEX is case sensitive
|
||||
* java-imports
|
||||
* [#1546](https://sourceforge.net/p/pmd/bugs/1546/): \[java] UnnecessaryFullyQualifiedNameRule doesn't take into consideration conflict resolution
|
||||
* XML
|
||||
* [#1518](https://sourceforge.net/p/pmd/bugs/1518/): \[xml] Error while processing xml file with ".webapp" in the file or directory name
|
||||
* psql
|
||||
|
Reference in New Issue
Block a user