Set<SourceFolder> (Module module) { Set<SourceFolder> result = new HashSet<>(); ContentEntry[] contentEntries = ModuleRootManager.getInstance(module).getContentEntries(); for (ContentEntry contentEntry : contentEntries) { for (SourceFolder folder : contentEntry.getSourceFolders()) { if (folder.getFile() == null) continue; result.add(folder); } } return result; }