String (@NotNull PsiPackageAccessibilityStatement.Role role, @NotNull Set<String> moduleRefNames, @NotNull String packageName) { String roleText = null; if (role == PsiPackageAccessibilityStatement.Role.EXPORTS) { roleText = PsiKeyword.EXPORTS; } else if (role == PsiPackageAccessibilityStatement.Role.OPENS) { roleText = PsiKeyword.OPENS; } assert roleText != null; String moduleRefsText; if (moduleRefNames.isEmpty()) { moduleRefsText = ""; } else { moduleRefsText = " to " + String.join(",", moduleRefNames); } return roleText + " " + packageName + moduleRefsText; }