forked from phoedos/pmd
Split test cases for granularity
This commit is contained in:
@ -2110,7 +2110,7 @@ which makes the code also more readable.
|
||||
|
||||
**This rule is defined by the following XPath expression:**
|
||||
``` xpath
|
||||
//VariableInitializer
|
||||
//VariableInitializer[preceding-sibling::VariableDeclaratorId[1]/@TypeInferred="false"]
|
||||
//PrimaryExpression[not(PrimarySuffix)]
|
||||
[not(ancestor::ArgumentList)]
|
||||
/PrimaryPrefix/AllocationExpression[ClassOrInterfaceType[@AnonymousClass='false']/TypeArguments//ReferenceType[not(.//TypeArguments)]]
|
||||
|
@ -61,18 +61,33 @@ public class Foo {
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>#1624[java] UseDiamondOperator doesn't work with var</description>
|
||||
<expected-problems>2</expected-problems>
|
||||
<expected-linenumbers>6,7</expected-linenumbers>
|
||||
<expected-problems>1</expected-problems>
|
||||
<expected-linenumbers>6</expected-linenumbers>
|
||||
<code><![CDATA[
|
||||
import java.util.ArrayList;
|
||||
public class Buzz {
|
||||
public void buzz() {
|
||||
var f = new ArrayList<String>();
|
||||
f = new ArrayList<>();
|
||||
f = new ArrayList<String>(); // flagged by rule
|
||||
List<String> foo, bar = new ArrayList<String>(), baz = new ArrayList<>(); //flagged only once
|
||||
var f = new ArrayList<String>(); // ok
|
||||
f = new ArrayList<>(); // ok
|
||||
f = new ArrayList<String>(); // flagged by rule
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
<test-code>
|
||||
<description>Multiple initializations in a single declaration</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<expected-linenumbers>6</expected-linenumbers>
|
||||
<code><![CDATA[
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
public class Buzz {
|
||||
public void buzz() {
|
||||
List<String> foo,
|
||||
bar = new ArrayList<String>(), // flagged
|
||||
baz = new ArrayList<>(); // ok
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
|
Reference in New Issue
Block a user