void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiElement parent = element.getParent(); if (!(parent instanceof PsiTypeCastExpression typeCastExpression)) { return; } if (!isUnnecessaryPrimitiveNumericCast(typeCastExpression)) { return; } PsiElement grandParent = parent.getParent(); while (grandParent instanceof PsiParenthesizedExpression) { parent = grandParent; grandParent = parent.getParent(); } final PsiExpression operand = typeCastExpression.getOperand(); if (operand == null) { parent.delete(); } else { parent.replace(operand); } }