int (PsiElement element) { int result = RefactoringUtil.EXPR_COPY_SAFE; if (element == null) return result; if (element instanceof GrNamedElement) { return RefactoringUtil.EXPR_COPY_SAFE; } if (element instanceof GrMethodCallExpression) { result = RefactoringUtil.EXPR_COPY_UNSAFE; } if (element instanceof GrNewExpression) { return RefactoringUtil.EXPR_COPY_PROHIBITED; } if (element instanceof GrAssignmentExpression) { return RefactoringUtil.EXPR_COPY_PROHIBITED; } if (element instanceof GrClosableBlock) { return RefactoringUtil.EXPR_COPY_PROHIBITED; } if (isPlusPlusOrMinusMinus(element)) { return RefactoringUtil.EXPR_COPY_PROHIBITED; } PsiElement[] children = element.getChildren(); for (PsiElement child : children) { int childResult = verifySafeCopyExpressionSubElement(child); result = Math.max(result, childResult); } return result; }