void (@NotNull PsiJavaModule moduleDescriptor, @NotNull Set<String> packageStatementsText) { List<PsiPackageAccessibilityStatement> packageStatements = new SmartList<>(); for (PsiPackageAccessibilityStatement exportStatement : moduleDescriptor.getExports()) { packageStatements.add(exportStatement); } for (PsiPackageAccessibilityStatement openStatement : moduleDescriptor.getOpens()) { packageStatements.add(openStatement); } for (PsiPackageAccessibilityStatement packageStatement : packageStatements) { if (packageStatementsText.contains(packageStatement.getText())) { packageStatement.delete(); } } }