diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java index ad9b5f50f0f2..b19f433b1c0f 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java @@ -602,6 +602,7 @@ public class InferenceSession { } PsiSubstitutor prepareSubstitution() { + boolean foundErrorMessage = false; Iterator> iterator = InferenceVariablesOrder.resolveOrderIterator(myInferenceVariables, this); while (iterator.hasNext()) { final List variables = iterator.next(); @@ -610,7 +611,9 @@ public class InferenceSession { PsiType instantiation = inferenceVariable.getInstantiation(); //failed inference if (instantiation == PsiType.NULL) { - checkBoundsConsistency(mySiteSubstitutor, inferenceVariable); + if (!foundErrorMessage) { + foundErrorMessage = checkBoundsConsistency(mySiteSubstitutor, inferenceVariable) == PsiType.NULL; + } mySiteSubstitutor = mySiteSubstitutor .put(typeParameter, JavaPsiFacade.getInstance(typeParameter.getProject()).getElementFactory().createType(typeParameter)); } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IncludeConstraintsWhenParentMethodIsDuringCalculation.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IncludeConstraintsWhenParentMethodIsDuringCalculation.java index 8869943add57..7d5c0557acf7 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IncludeConstraintsWhenParentMethodIsDuringCalculation.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IncludeConstraintsWhenParentMethodIsDuringCalculation.java @@ -12,10 +12,7 @@ class Test { SuperFoo ls = foo(() -> new Foo<>()); +upper bounds: Object, Number">() -> new Foo<>()); SuperFoo li = foo(() -> new Foo<>()); SuperFoo lw = foo(() -> new Foo<>()); } \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/NestedLambdaExpressionsNoFormalParams.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/NestedLambdaExpressionsNoFormalParams.java index 58dff582cc2c..ce91ef6d55e1 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/NestedLambdaExpressionsNoFormalParams.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/NestedLambdaExpressionsNoFormalParams.java @@ -29,10 +29,7 @@ abstract class NoFormalParamTypeInferenceNeeded { Integer zip = zip(a -> zip(text -> text)); +upper bounds: Object, Integer">text -> text)); } }