mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
checked exception constraints: ensure ground type (IDEA-173200)
This commit is contained in:
@@ -17,7 +17,6 @@ package com.intellij.psi.impl.source.resolve.graphInference.constraints;
|
||||
|
||||
import com.intellij.codeInsight.ExceptionUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
|
||||
import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
|
||||
@@ -76,7 +75,7 @@ public class CheckedExceptionCompatibilityConstraint extends InputOutputConstrai
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiSubstitutor substitutor = LambdaUtil.getSubstitutor(interfaceMethod, PsiUtil.resolveGenericsClassInType(myT));
|
||||
final PsiSubstitutor substitutor = LambdaUtil.getSubstitutor(interfaceMethod, PsiUtil.resolveGenericsClassInType(groundTargetType));
|
||||
if (myExpression instanceof PsiLambdaExpression && !((PsiLambdaExpression)myExpression).hasFormalParameterTypes() ||
|
||||
myExpression instanceof PsiMethodReferenceExpression && !((PsiMethodReferenceExpression)myExpression).isExact()) {
|
||||
for (PsiParameter parameter : interfaceMethod.getParameterList().getParameters()) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.util.function.Function;
|
||||
|
||||
class Main {
|
||||
public static void main(String[] args) {
|
||||
runTest(Main::test, UncheckedIOException:: new);
|
||||
}
|
||||
|
||||
private static void test() throws IOException {}
|
||||
|
||||
private static <E extends Throwable> void runTest(A<? extends E> a, Function<E, ?> b) { }
|
||||
|
||||
@FunctionalInterface
|
||||
public interface A<E extends Throwable> {
|
||||
void foo() throws E;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -173,6 +173,7 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testMethodREfToContainingMethodWithGenericParam() { doTest(); }
|
||||
public void testDistinguishCapturedWildcardsByDifferentParameters() throws Exception { doTest(); }
|
||||
public void testConstructorRefOnClassWithRecursiveTypeParameter() throws Exception { doTest(); }
|
||||
public void testWildcardInCheckedCompatibilityConstraints() { doTest(); }
|
||||
|
||||
public void testPreferErrorOnTopLevelToFailedSubstitutorOnNestedLevel() { doTest(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user