forked from phoedos/pmd
[java] UnnecessaryCastRule: verify clone is not flagged
This commit is contained in:
@ -120,6 +120,19 @@ public class UnnecessaryCastSample {
|
||||
Map<String, ?> map = new HashMap<>();
|
||||
String dataFromMap = (String) map.get("foo");
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>Avoid clone false-positive</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class UnnecessaryCastSample {
|
||||
public void localVars() {
|
||||
List<String> strings = new ArrayList<>();
|
||||
List<String> copy = (List<String>) strings.clone();
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
Reference in New Issue
Block a user