mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-22 23:08:54 +07:00
SuspiciousArrayMethodCallInspection: erased types are compared (fixes IDEA-172742). As the corresponding argument accepts Object or Object[], exact generic signature cannot be always inferred.
This commit is contained in:
@@ -72,6 +72,8 @@ public class SuspiciousArrayMethodCallInspection extends BaseJavaBatchLocalInspe
|
||||
PsiType arrayElementType = ((PsiArrayType)arrayType).getComponentType();
|
||||
// incompatible primitive array will be reported anyways as compilation error
|
||||
if (arrayElementType instanceof PsiPrimitiveType) return;
|
||||
elementType = TypeConversionUtil.erasure(elementType);
|
||||
arrayElementType = TypeConversionUtil.erasure(arrayElementType);
|
||||
if (!TypeConversionUtil.areTypesConvertible(elementType, arrayElementType)) {
|
||||
holder.registerProblem(element, InspectionsBundle.message("inspection.suspicious.array.method.call.problem.element"));
|
||||
}
|
||||
@@ -85,6 +87,8 @@ public class SuspiciousArrayMethodCallInspection extends BaseJavaBatchLocalInspe
|
||||
PsiType array2ElementType = ((PsiArrayType)array2Type).getComponentType();
|
||||
// incompatible primitive array will be reported anyways as compilation error
|
||||
if (array1ElementType instanceof PsiPrimitiveType || array2ElementType instanceof PsiPrimitiveType) return;
|
||||
array1ElementType = TypeConversionUtil.erasure(array1ElementType);
|
||||
array2ElementType = TypeConversionUtil.erasure(array2ElementType);
|
||||
if (!TypeConversionUtil.areTypesConvertible(array1ElementType, array2ElementType) ||
|
||||
!TypeConversionUtil.areTypesConvertible(array2ElementType, array1ElementType)) {
|
||||
holder.registerProblem(context, InspectionsBundle.message("inspection.suspicious.array.method.call.problem.arrays"));
|
||||
|
||||
Reference in New Issue
Block a user