diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcWatchedRootProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcWatchedRootProvider.java index 0da63368e7c8..d8e5dd45b76e 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcWatchedRootProvider.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcWatchedRootProvider.java @@ -27,16 +27,16 @@ public class MvcWatchedRootProvider implements WatchedRootsProvider { @NotNull public Set getRootsToWatch() { - if (!myProject.isInitialized()) { - return Collections.emptySet(); - } + if (!myProject.isInitialized()) return Collections.emptySet(); - final Set result = new HashSet(); + Set result = null; for (Module module : ModuleManager.getInstance(myProject).getModules()) { final MvcFramework framework = MvcModuleStructureSynchronizer.getFramework(module); if (framework == null) continue; + if (result == null) result = new HashSet(); + final File sdkWorkDir = framework.getCommonPluginsDir(module); if (sdkWorkDir != null) { result.add(sdkWorkDir.getAbsolutePath()); @@ -48,7 +48,7 @@ public class MvcWatchedRootProvider implements WatchedRootsProvider { } } - return result; + return result == null ? Collections.emptySet() : result; } }