redundant cast: ensure lambda return statements are not mixed with those from containing method (IDEA-138724)

This commit is contained in:
Anna Kozlova
2015-04-02 18:06:41 +02:00
parent 3b40026df9
commit 80e3760c69
3 changed files with 21 additions and 1 deletions
@@ -0,0 +1,19 @@
import java.util.Optional;
class CommandTest {
public Object getObject() {
Optional<Object> o = Optional.of("x");
return o.map(bx -> {
return (Object)"";
})
.orElse(new Integer(1));
}
public Object getObject1() {
Optional<Object> o = Optional.of("x");
return o.map(bx -> {
return (<warning descr="Casting 'new Object()' to 'Object' is redundant">Object</warning>)new Object();
})
.orElse(new Integer(1));
}
}