void (@NotNull PsiTypeCastExpression expression) { if (!reportCast) return; final PsiTypeElement typeElement = expression.getCastType(); if (!typeIsConcreteClass(typeElement)) return; final PsiMethod method = PsiTreeUtil.getParentOfType(expression, PsiMethod.class, true, PsiClass.class, PsiLambdaExpression.class); if (MethodUtils.isEquals(method) || CloneUtils.isClone(method)) return; registerError(typeElement, InspectionGadgetsBundle .message("cast.to.concrete.class.problem.descriptor", typeElement.getType().getPresentableText())); }