mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 18:09:38 +07:00
lambda.isValueCompatible should not cache inference results for calls inside lambda body as they may depend on incomplete top level inference where LambdaExpressionCompatibilityConstraint is reduced (IDEA-156311)
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
|
||||
import java.util.function.Supplier;
|
||||
import java.io.IOException;
|
||||
|
||||
interface A {
|
||||
}
|
||||
|
||||
interface B extends A {
|
||||
}
|
||||
|
||||
interface D<TT extends Exception> {
|
||||
<T extends A, E extends TT> T foo() throws E;
|
||||
}
|
||||
|
||||
class E {
|
||||
|
||||
void bar(D<RuntimeException> d) {
|
||||
foobar(supplier(() -> {
|
||||
try {
|
||||
return d.foo();
|
||||
} catch (RuntimeException e) {
|
||||
throw e;
|
||||
}
|
||||
}));
|
||||
foobar(supplier(() -> {
|
||||
return d.foo();
|
||||
}));
|
||||
|
||||
foobar(supplier(() -> d.foo()));
|
||||
foobar(supplier(d::foo));
|
||||
|
||||
foobar(supplier(() -> {
|
||||
throw new RuntimeException();
|
||||
}));
|
||||
}
|
||||
|
||||
<T> Supplier<T> supplier(Supplier<T> s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
void foobar(Supplier<B> s) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Test {
|
||||
interface A {
|
||||
}
|
||||
|
||||
interface B extends A {
|
||||
}
|
||||
|
||||
interface D {
|
||||
<T extends A> T foo() throws IOException;
|
||||
}
|
||||
|
||||
class E {
|
||||
|
||||
void bar(D d) {
|
||||
foobar(supplier(() -> {
|
||||
try {
|
||||
return d.foo();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
<T> Supplier<T> supplier(Supplier<T> s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
void foobar(Supplier<B> s) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TestNoTypeParameterBounds {
|
||||
|
||||
interface A {
|
||||
}
|
||||
|
||||
interface B extends A {
|
||||
}
|
||||
|
||||
interface D {
|
||||
<T extends A, E extends Throwable> T foo() throws E;
|
||||
}
|
||||
|
||||
class E {
|
||||
|
||||
void bar(D d) {
|
||||
foobar(supplier(() -> {
|
||||
try {
|
||||
return d.foo();
|
||||
} catch (RuntimeException e) {
|
||||
throw e;
|
||||
}
|
||||
}));
|
||||
foobar(supplier(() -> {
|
||||
return d.foo();
|
||||
}));
|
||||
|
||||
foobar(supplier(() -> d.foo()));
|
||||
foobar(supplier(d::foo));
|
||||
|
||||
foobar(supplier(() -> {
|
||||
throw new RuntimeException();
|
||||
}));
|
||||
}
|
||||
|
||||
<T> Supplier<T> supplier(Supplier<T> s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
void foobar(Supplier<B> s) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user