mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
checked exception compatibility constraint: don't substitute with inferred variables as types are already constructed based on substituted values, so avoid dbl substitution which leads to errors in case of references to the containing method (IDEA-166104)
This commit is contained in:
@@ -83,7 +83,7 @@ public class CheckedExceptionCompatibilityConstraint extends InputOutputConstrai
|
||||
if (myExpression instanceof PsiLambdaExpression && !((PsiLambdaExpression)myExpression).hasFormalParameterTypes() ||
|
||||
myExpression instanceof PsiMethodReferenceExpression && !((PsiMethodReferenceExpression)myExpression).isExact()) {
|
||||
for (PsiParameter parameter : interfaceMethod.getParameterList().getParameters()) {
|
||||
final PsiType type = session.substituteWithInferenceVariables(substitutor.substitute(parameter.getType()));
|
||||
final PsiType type = substitutor.substitute(parameter.getType());
|
||||
if (!session.isProperType(type)) {
|
||||
session.registerIncompatibleErrorMessage("Parameter type is not yet inferred: " + session.getPresentableText(type));
|
||||
return false;
|
||||
@@ -93,7 +93,7 @@ public class CheckedExceptionCompatibilityConstraint extends InputOutputConstrai
|
||||
|
||||
final PsiType returnType = interfaceMethod.getReturnType();
|
||||
if (myExpression instanceof PsiLambdaExpression || !((PsiMethodReferenceExpression)myExpression).isExact()) {
|
||||
final PsiType type = session.substituteWithInferenceVariables(substitutor.substitute(returnType));
|
||||
final PsiType type = substitutor.substitute(returnType);
|
||||
if (!session.isProperType(type)) {
|
||||
session.registerIncompatibleErrorMessage("Return type is not yet inferred: " + session.getPresentableText(type));
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
interface TreeUtils {
|
||||
|
||||
static <K> Stream<List<K>> treeStream(List<K> treeItem) {
|
||||
Stream<List<K>> stream = null;
|
||||
stream.flatMap(TreeUtils::treeStream);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -537,6 +537,10 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMethodREfToContainingMethodWithGenericParam() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user