functional type erasure: check if resulted type functional (IDEA-142341)

This commit is contained in:
Anna Kozlova
2015-07-07 12:20:04 +03:00
parent 9757f190f3
commit 303edac35e
3 changed files with 45 additions and 2 deletions

View File

@@ -0,0 +1,39 @@
interface Functional {
void a(String s);
}
interface NonFunctional {
void b(String s);
void c();
}
interface P<<warning descr="Type parameter 'T' is never used">T</warning>> {
void subscribe(Functional f);
void subscribe(NonFunctional nf);
}
class Test {
void foo(P p) {
p.subscribe(s -> {});
}
}
interface FunctionalExact {
void a();
}
interface NonFunctionalExact {
void b();
void c();
}
interface PExact<<warning descr="Type parameter 'T' is never used">T</warning>> {
void subscribe(FunctionalExact f);
void subscribe(NonFunctionalExact nf);
}
class TestExact {
void foo(PExact p) {
p.subscribe(() -> {});
}
}