wildcards in receiver type supported (IDEA-92699)

This commit is contained in:
anna
2012-10-10 15:10:42 +02:00
parent e946c087fb
commit b929c5ad2f
3 changed files with 25 additions and 1 deletions
@@ -637,7 +637,7 @@ public class LambdaUtil {
}
public static boolean isReceiverType(PsiType receiverType, PsiClass containingClass, PsiSubstitutor psiSubstitutor) {
final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(receiverType);
final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(GenericsUtil.eliminateWildcards(receiverType));
final PsiClass receiverClass = resolveResult.getElement();
if (receiverClass != null && isReceiverType(receiverClass, containingClass)) {
return resolveResult.getSubstitutor().equals(psiSubstitutor) ||
@@ -0,0 +1,20 @@
import java.util.*;
class MyTest2{
{
Comparator<? super String> comparator = String::compareToIgnoreCase;
}
}
class Test {
void test() {
Foo2<? extends Bar2> foo2 = Bar2::xxx;
}
}
interface Foo2<T> {
void bar(T i, T j);
}
interface Bar2 {
public void xxx(Bar2 p) default {}
}
@@ -109,6 +109,10 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testWildcards() throws Exception {
doTest();
}
public void testInferenceFromReturnType() throws Exception {
doTest(true);
}