void (@NotNull PsiParenthesizedExpression parenthesizedExpression, boolean ignoreClarifyingParentheses) { final PsiExpression body = parenthesizedExpression.getExpression(); // Do not remove empty parentheses, as incorrect Java expression could become incorrect PSI // E.g. ()+=foo is correct PSI, but removing () will yield an assignment without LExpression which is invalid. if (body == null) return; final PsiElement parent = parenthesizedExpression.getParent(); if (!(parent instanceof PsiExpression expression) || !areParenthesesNeeded(body, expression, ignoreClarifyingParentheses)) { CommentTracker commentTracker = new CommentTracker(); commentTracker.markUnchanged(body); PsiExpression newExpression = (PsiExpression)commentTracker.replaceAndRestoreComments(parenthesizedExpression, body); removeParentheses(newExpression, ignoreClarifyingParentheses); } else { removeParentheses(body, ignoreClarifyingParentheses); } }