method refs: do not warn about type args over raw types, non parameterized methods (IDEA-92851)

This commit is contained in:
Anna Kozlova
2012-10-12 14:56:44 +02:00
parent 58c7d3e5da
commit beb2c4df54
3 changed files with 22 additions and 1 deletions
@@ -1292,7 +1292,7 @@ public class GenericsHighlightUtil {
if (((PsiModifierListOwner)element).hasModifierProperty(PsiModifier.STATIC)) return null;
PsiClass containingClass = ((PsiMember)element).getContainingClass();
if (containingClass != null && PsiUtil.isRawSubstitutor(containingClass, resolveResult.getSubstitutor())) {
if (parent instanceof PsiCallExpression && PsiUtil.isLanguageLevel7OrHigher(parent)) {
if ((parent instanceof PsiCallExpression || parent instanceof PsiMethodReferenceExpression) && PsiUtil.isLanguageLevel7OrHigher(parent)) {
return null;
}
final String message = element instanceof PsiClass
@@ -0,0 +1,17 @@
class Test<T> {
void foo(String p) {}
<U> void foo1(String p) {}
static void foo2(String p) {}
static <U> void foo3(String p) {}
void test() {
Test test = new Test<String>();
BlahBlah<String> blahBlah = test::<String>foo;
BlahBlah<String> blahBlah1 = test::<String>foo1;
BlahBlah<String> blahBlah2 = test::<String>foo2;
BlahBlah<String> blahBlah3 = test::<String>foo3;
}
}
interface BlahBlah<T> {
void bar(T i);
}
@@ -125,6 +125,10 @@ public class MethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
public void testTypeArgumentsOnMethodRefs() throws Exception {
doTest();
}
public void testInferenceFromReturnType() throws Exception {
doTest(true);
}