List<PsiDirectory> (Module module) { List<PsiDirectory> dirs = new ArrayList<>(); VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots(); for (VirtualFile root : contentRoots) { PsiDirectory dir = PsiManager.getInstance(module.getProject()).findDirectory(root); if (dir != null) { dirs.add(dir); } } return dirs; }