redundant cast: mark raw cast as redundant when raw is expected (IDEA-162022)

This commit is contained in:
Anna.Kozlova
2016-10-04 18:45:14 +02:00
parent 1cf1300ab1
commit 1f41202f49
3 changed files with 18 additions and 2 deletions
@@ -0,0 +1,17 @@
import java.util.Map;
class Main {
private final Map<String, BreakpointState<?,?,?>> myBreakpointsDefaults = null;
@SuppressWarnings("unchecked")
public BreakpointState<String, String, String> foo1(String type, BreakpointState<?, ?, ?> defaults) {
return (BreakpointState) myBreakpointsDefaults.computeIfAbsent(type, k -> defaults);
}
public BreakpointState foo2(String type, BreakpointState<?, ?, ?> defaults) {
return (<warning descr="Casting 'myBreakpointsDefaults.computeIfAbsent(type, k -> defaults)' to 'BreakpointState' is redundant">BreakpointState</warning>) myBreakpointsDefaults.computeIfAbsent(type, k -> defaults);
}
private static class BreakpointState<A, B, C> {}
}