int (PsiElement element) { int result = EXPR_COPY_SAFE; if (element == null) return result; if (element instanceof PsiThisExpression || element instanceof PsiSuperExpression || element instanceof PsiIdentifier) { return EXPR_COPY_SAFE; } if (element instanceof PsiMethodCallExpression) { result = EXPR_COPY_UNSAFE; } if (element instanceof PsiNewExpression) { return EXPR_COPY_PROHIBITED; } if (element instanceof PsiAssignmentExpression) { return EXPR_COPY_PROHIBITED; } if (PsiUtil.isIncrementDecrementOperation(element)) { return EXPR_COPY_PROHIBITED; } PsiElement[] children = element.getChildren(); for (PsiElement child : children) { int childResult = verifySafeCopyExpressionSubElement(child); result = Math.max(result, childResult); } return result; }