void (@NotNull PsiTypeCastExpression expression) { super.visitTypeCastExpression(expression); final PsiTypeElement typeElement = expression.getCastType(); if (typeElement == null) { return; } final PsiType castType = typeElement.getType(); if (!(castType instanceof PsiArrayType)) { return; } final PsiExpression operand = expression.getOperand(); if (operand == null) { return; } final PsiType type = operand.getType(); if (!(type instanceof PsiArrayType)) { return; } final PsiClass castClass = PsiUtil.resolveClassInClassTypeOnly(castType.getDeepComponentType()); if (castClass == null) { return; } final PsiClass aClass = PsiUtil.resolveClassInClassTypeOnly(type.getDeepComponentType()); if (aClass == null || !castClass.isInheritor(aClass, true) || isCollectionToArrayCall(operand)) { return; } registerError(typeElement); }