java: discard functional expressions with unbounded wildcards which type parameters depend on other type parameters (IDEA-267644)

old spec issue is still not resolved and most probably won't be resolved in the future as would lead to the incompatibilities

GitOrigin-RevId: be74d8ca83ce3c47d1e3dc9eb08de789fb881d2b
This commit is contained in:
Anna Kozlova
2021-04-29 21:40:00 +00:00
committed by intellij-monorepo-bot
parent f5a6a58052
commit e59155ed16
2 changed files with 18 additions and 6 deletions
@@ -36,9 +36,9 @@ class ExtendsList {
}
{
I<?, ? extends String> n = () -> null;
I<?, ?> n1 = () -> null;
I<?, String> n2 = () -> null;
I<?, ? extends String> n = <error descr="Cannot infer functional interface type">() -> null</error>;
I<?, ?> n1 = <error descr="Cannot infer functional interface type">() -> null</error>;
I<?, String> n2 = <error descr="Cannot infer functional interface type">() -> null</error>;
I<? extends List<?>, String> e1 = <error descr="Cannot infer functional interface type">() -> null</error>;
@@ -59,7 +59,7 @@ class MultipleBounds {
interface LC<K> extends List<K>, Comparable<K> {}
{
I<?, String> n = () -> null;
I<?, String> n = <error descr="Cannot infer functional interface type">() -> null</error>;
I<? extends List<String>, ? extends String> e1 = <error descr="Cannot infer functional interface type">() -> null</error>;
I<? extends Comparable<String>, ? extends String> e2 = <error descr="Cannot infer functional interface type">() -> null</error>;
@@ -77,7 +77,7 @@ class FirstIndependentBound {
interface LC<K> extends List<String>, Comparable<K> {}
{
I<?, String> n = () -> null;
I<?, String> n = <error descr="Cannot infer functional interface type">() -> null</error>;
I<? extends List<String>, ? extends String> e1 = <error descr="Cannot infer functional interface type">() -> null</error>;
I<? extends Comparable<String>, ? extends String> e2 = <error descr="Cannot infer functional interface type">() -> null</error>;
@@ -96,7 +96,7 @@ class SecondIndependentBound {
interface LC<K> extends List<String>, Comparable<K> {}
{
I<?, String> n = () -> null;
I<?, String> n = <error descr="Cannot infer functional interface type">() -> null</error>;
I<? extends List<String>, ? extends String> e1 = <error descr="Cannot infer functional interface type">() -> null</error>;
I<? extends Comparable<String>, ? extends String> e2 = <error descr="Cannot infer functional interface type">() -> null</error>;
@@ -105,4 +105,13 @@ class SecondIndependentBound {
I<? extends LC<? extends String>, String> e5 = <error descr="Cannot infer functional interface type">() -> null</error>;
I<? extends LC<? extends String>, ? extends String> e6 = <error descr="Cannot infer functional interface type">() -> null</error>;
}
}
interface Unbound<A extends Number, B extends A> {
void accept();
static void m() {
Unbound<?, ?> s = <error descr="Cannot infer functional interface type">() -> {}</error>;
Unbound<?, ? extends Number> s1 = () -> {};
}
}