avoid checks over not applicable methods (IDEA-156196)

This commit is contained in:
Anna.Kozlova
2016-05-19 16:47:28 +02:00
parent 18e4b2842b
commit 25352dce0b
3 changed files with 39 additions and 3 deletions
@@ -472,10 +472,11 @@ public class ExceptionUtil {
@Override
public Pair<PsiMethod, PsiSubstitutor> fun(CandidateInfo info) {
PsiElement element = info.getElement();
if (element instanceof PsiMethod &&
if (info instanceof MethodCandidateInfo &&
MethodSignatureUtil.areSignaturesEqual(method, (PsiMethod)element) &&
!MethodSignatureUtil.isSuperMethod((PsiMethod)element, method)) {
return Pair.create((PsiMethod)element, info.getSubstitutor());
!MethodSignatureUtil.isSuperMethod((PsiMethod)element, method) &&
((MethodCandidateInfo)info).isApplicable()) {
return Pair.create((PsiMethod)element, ((MethodCandidateInfo)info).getSubstitutor(false));
}
return null;
}
@@ -0,0 +1,31 @@
import java.io.IOException;
import java.util.List;
class Reproduction
{
public static List<Reproduction> a() throws IOException {
return exe(connection -> {
Object stmt = null;
return st(Reproduction.class, 1, "");
});
}
public static List<Reproduction> b() throws IOException {
return exe(connection -> {
return st(Reproduction.class, 1, "");
});
}
static <K> List<K> st(Class<K> c, Object... o) throws IOException {
return null;
}
static <V> V exe(VFunction<V> vFunction) throws IOException {
return vFunction.apply("");
}
interface VFunction<V> {
V apply(String s) throws IOException;
}
}
@@ -320,6 +320,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testVarargMethodWithThrownTypes() throws Exception {
doTest();
}
private void doTest() {
doTest(false);
}