mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
take into account container class type parameters: unchecked warnings
This commit is contained in:
+8
-4
@@ -474,14 +474,18 @@ public class UncheckedWarningLocalInspectionBase extends BaseJavaBatchLocalInspe
|
||||
|
||||
@Override
|
||||
public Boolean visitClassType(PsiClassType classType) {
|
||||
PsiClass psiClass = classType.resolve();
|
||||
PsiClassType.ClassResolveResult result = classType.resolveGenerics();
|
||||
PsiClass psiClass = result.getElement();
|
||||
if (psiClass instanceof PsiTypeParameter) {
|
||||
if (((PsiTypeParameter)psiClass).getOwner() == method) return Boolean.FALSE;
|
||||
return substitutor.substitute((PsiTypeParameter)psiClass) == null ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
PsiType[] parameters = classType.getParameters();
|
||||
for (PsiType parameter : parameters) {
|
||||
if (parameter.accept(this).booleanValue()) return Boolean.TRUE;
|
||||
if (psiClass != null) {
|
||||
PsiSubstitutor typeSubstitutor = result.getSubstitutor();
|
||||
for (PsiTypeParameter parameter : PsiUtil.typeParametersIterable(psiClass)) {
|
||||
PsiType psiType = typeSubstitutor.substitute(parameter);
|
||||
if (psiType != null && psiType.accept(this).booleanValue()) return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
+11
@@ -36,6 +36,17 @@ class b {
|
||||
}
|
||||
}
|
||||
|
||||
class aOuter<E> {
|
||||
|
||||
class Inner {
|
||||
void f(aOuter<E>.Inner t) { t.hashCode();}
|
||||
}
|
||||
|
||||
void f(aOuter.Inner raw) {
|
||||
<warning descr="Unchecked call to 'f(Inner)' as a member of raw type 'aOuter.Inner'">raw.f</warning>(raw);
|
||||
}
|
||||
}
|
||||
|
||||
class List<T> {
|
||||
<V> V[] toArray (V[] vs) { return vs; }
|
||||
void add(T t) {
|
||||
|
||||
Reference in New Issue
Block a user