void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { if (!(element instanceof PsiReferenceExpression referenceExpression)) { return; } if (referenceExpression.getType() instanceof PsiArrayType) { PsiReplacementUtil.replaceExpression(referenceExpression, referenceExpression.getText() + ".clone()"); } else { final String type = TypeUtils.expressionHasTypeOrSubtype(referenceExpression, CommonClassNames.JAVA_UTIL_DATE, CommonClassNames.JAVA_UTIL_CALENDAR); if (type == null) { return; } PsiReplacementUtil.replaceExpression(referenceExpression, '(' + type + ')' + referenceExpression.getText() + ".clone()"); } }