mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-110684 (Raw Parameterized Warning on Overridden Methods)
This commit is contained in:
+18
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2012 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2003-2013 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.psi.util.PsiUtil;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import com.siyeh.ig.psiutils.MethodUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -115,6 +116,21 @@ public class RawUseOfParameterizedTypeInspection extends BaseInspection {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (parent instanceof PsiParameter) {
|
||||
final PsiParameter parameter = (PsiParameter)parent;
|
||||
final PsiElement declarationScope = parameter.getDeclarationScope();
|
||||
if (declarationScope instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)declarationScope;
|
||||
if (MethodUtils.hasSuper(method)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (parent instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)parent;
|
||||
if (MethodUtils.hasSuper(method)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
final PsiJavaCodeReferenceElement referenceElement = typeElement.getInnermostComponentReferenceElement();
|
||||
checkReferenceElement(referenceElement);
|
||||
}
|
||||
@@ -164,11 +180,7 @@ public class RawUseOfParameterizedTypeInspection extends BaseInspection {
|
||||
}
|
||||
|
||||
private boolean hasNeededLanguageLevel(PsiElement element) {
|
||||
if (element.getLanguage() != JavaLanguage.INSTANCE) {
|
||||
return false;
|
||||
}
|
||||
return PsiUtil.isLanguageLevel5OrHigher(element);
|
||||
return element.getLanguage() == JavaLanguage.INSTANCE && PsiUtil.isLanguageLevel5OrHigher(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
@@ -28,3 +28,13 @@ class RawUseOfParameterizedType {
|
||||
Map.Entry<String, String> entry;
|
||||
}
|
||||
}
|
||||
interface X {
|
||||
List foo(Map map);
|
||||
}
|
||||
class Y implements X {
|
||||
|
||||
@Override
|
||||
public List foo(Map map) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -14,4 +14,18 @@
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Raw use of parameterized class</problem_class>
|
||||
<description>Raw use of parameterized class <code>ArrayList</code> #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>RawUseOfParameterizedType.java</file>
|
||||
<line>32</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Raw use of parameterized class</problem_class>
|
||||
<description>Raw use of parameterized class <code>List</code> #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>RawUseOfParameterizedType.java</file>
|
||||
<line>32</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Raw use of parameterized class</problem_class>
|
||||
<description>Raw use of parameterized class <code>Map</code> #loc</description>
|
||||
</problem>
|
||||
</problems>
|
||||
Reference in New Issue
Block a user