semantic cast to &Serializable for functional expressions is not redundant even if expression is inside parenthesis (IDEA-143922)

This commit is contained in:
Anna Kozlova
2015-08-20 19:31:05 +02:00
parent c0de8d22c6
commit a93ad570ca
4 changed files with 29 additions and 4 deletions
@@ -9,6 +9,6 @@ class Test {
{
Predicate<String> mh1 = (Predicate<String> & Serializable)Test::test;
Predicate<String> mh0 = (Predicate<String> & <error descr="Repeated interface">Predicate<String></error>)Test::test;
Predicate<String> mh0 = (<warning descr="Casting 'Test::test' to 'Predicate<String> & Predicate<String>' is redundant">Predicate<String> & <error descr="Repeated interface">Predicate<String></error></warning>)Test::test;
}
}
@@ -0,0 +1,14 @@
import java.io.Serializable;
class Test {
public static void main(String[] args) {
Runnable r = (Runnable & Serializable) (() -> {});
r = (Runnable & Serializable)() -> {};
r = (<warning descr="Casting '() -> {}' to 'Runnable & I' is redundant">Runnable & I</warning>)() -> {};
System.out.println(r);
}
interface I {}
}