unchecked call: warning should be shown if instance method is called on raw type (IDEA-61449)

This commit is contained in:
Anna Kozlova
2012-11-01 19:08:11 +01:00
parent 8213749000
commit 5f0225177e
3 changed files with 9 additions and 1 deletions
@@ -421,6 +421,7 @@ public class UncheckedWarningLocalInspection extends BaseJavaLocalInspectionTool
final PsiMethod method = (PsiMethod)resolveResult.getElement();
if (method == null) return null;
final PsiSubstitutor substitutor = resolveResult.getSubstitutor();
if (!PsiUtil.isRawSubstitutor(method, substitutor)) return null;
final PsiParameter[] parameters = method.getParameterList().getParameters();
for (final PsiParameter parameter : parameters) {
final PsiType parameterType = parameter.getType();
@@ -448,7 +449,7 @@ public class UncheckedWarningLocalInspection extends BaseJavaLocalInspectionTool
public Boolean visitWildcardType(PsiWildcardType wildcardType) {
PsiType bound = wildcardType.getBound();
if (bound != null) return bound.accept(this);
return Boolean.FALSE;
return Boolean.TRUE;
}
public Boolean visitEllipsisType(PsiEllipsisType ellipsisType) {
@@ -0,0 +1,6 @@
class Test {
{
Class foo = Object.class;
<warning descr="Unchecked call to 'isAssignableFrom(Class<?>)' as a member of raw type 'java.lang.Class'">foo.isAssignableFrom</warning>(Object.class);
}
}
@@ -164,4 +164,5 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
public void testUsedMethodsByMethodReferences() throws Exception { doTest(true, true, false); }
public void testLambdaExpressions() throws Exception { doTest(false, true, false); }
public void testJava7CastConventions() throws Exception { doTest(false, true, false); }
public void testUncheckedWarning() throws Exception { doTest(true, false); }
}