diff --git a/java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java b/java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java index 8a12fac0e341..b177f9a9aa12 100644 --- a/java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java +++ b/java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java @@ -27,6 +27,7 @@ import com.intellij.util.indexing.FileBasedIndex; import com.intellij.util.io.DataInputOutputUtil; import com.intellij.util.messages.MessageBus; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.DataInputStream; import java.io.DataOutputStream; @@ -42,7 +43,7 @@ public class JavaLanguageLevelPusher implements FilePropertyPusher { ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.filePropertyPusher"); - void initExtra(Project project, MessageBus bus, Engine languageLevelUpdater); + void initExtra(@NotNull Project project, @NotNull MessageBus bus, @NotNull Engine languageLevelUpdater); @NotNull Key getFileDataKey(); boolean pushDirectoriesOnly(); @@ -42,19 +42,19 @@ public interface FilePropertyPusher { T getDefaultValue(); @Nullable - T getImmediateValue(Project project, VirtualFile file); + T getImmediateValue(@NotNull Project project, @Nullable VirtualFile file); @Nullable - T getImmediateValue(Module module); + T getImmediateValue(@NotNull Module module); - boolean acceptsFile(VirtualFile file); + boolean acceptsFile(@NotNull VirtualFile file); - void persistAttribute(VirtualFile fileOrDir, @NotNull T value) throws IOException; + void persistAttribute(@NotNull VirtualFile fileOrDir, @NotNull T value) throws IOException; - public interface Engine { + interface Engine { void pushAll(); - void pushRecursively(final VirtualFile vile, final Project project); + void pushRecursively(VirtualFile vile, Project project); } - void afterRootsChanged(Project project); + void afterRootsChanged(@NotNull Project project); } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java index 03c888842044..3995b10625f5 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java @@ -125,23 +125,25 @@ public class PushedFilePropertiesUpdater { }); } - private static T findPusherValuesUpwards(final Project project, final VirtualFile dir, FilePropertyPusher pusher, T moduleValue) { + private static T findPusherValuesUpwards(Project project, VirtualFile dir, FilePropertyPusher pusher, T moduleValue) { final T value = pusher.getImmediateValue(project, dir); if (value != null) return value; if (moduleValue != null) return moduleValue; final VirtualFile parent = dir.getParent(); if (parent != null) return findPusherValuesUpwards(project, parent, pusher); - return pusher.getDefaultValue(); + T projectValue = pusher.getImmediateValue(project, null); + return projectValue != null? projectValue : pusher.getDefaultValue(); } - private static T findPusherValuesUpwards(final Project project, final VirtualFile dir, FilePropertyPusher pusher) { + private static T findPusherValuesUpwards(Project project, VirtualFile dir, FilePropertyPusher pusher) { final T userValue = dir.getUserData(pusher.getFileDataKey()); if (userValue != null) return userValue; final T value = pusher.getImmediateValue(project, dir); if (value != null) return value; final VirtualFile parent = dir.getParent(); if (parent != null) return findPusherValuesUpwards(project, parent, pusher); - return pusher.getDefaultValue(); + T projectValue = pusher.getImmediateValue(project, null); + return projectValue != null ? projectValue : pusher.getDefaultValue(); } public void pushAll(final FilePropertyPusher... pushers) {