void (@NotNull PsiFile file, @NotNull Set<String> imports) { GroovyFile groovyFile = (GroovyFile)file; for (GrImportStatement statement : groovyFile.getImportStatements()) { if (imports.contains(statement.getImportedName())) { groovyFile.removeImport(statement); } } }