boolean (PsiMethodCallExpression call) { // Check that all arguments are enum different enum constants from the same enum PsiExpression[] expressions = call.getArgumentList().getExpressions(); if (expressions.length == 0) return false; Set<String> names = new HashSet<>(); PsiClass enumClass = null; for (PsiExpression arg : expressions) { PsiReferenceExpression ref = tryCast(skipParenthesizedExprDown(arg), PsiReferenceExpression.class); if (ref == null) return false; PsiEnumConstant enumConstant = tryCast(ref.resolve(), PsiEnumConstant.class); if (enumConstant == null || !names.add(enumConstant.getName())) return false; if (enumClass == null) { enumClass = enumConstant.getContainingClass(); } else if (enumConstant.getContainingClass() != enumClass) { return false; } } return true; }