workaround for GwtLanguageLevel pusher to affect java language level
authorMaxim.Mossienko <Maxim.Mossienko@jetbrains.com>
Mon, 14 Nov 2016 21:18:50 +0000 (22:18 +0100)
committerMaxim.Mossienko <Maxim.Mossienko@jetbrains.com>
Mon, 14 Nov 2016 21:18:50 +0000 (22:18 +0100)
java/java-analysis-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java

index 71fa0ce43b9be1b4c65bfb85a364993ee8518eb2..541701672227f5a4f75aa481b745e6d6c03f935f 100644 (file)
@@ -107,7 +107,16 @@ public class JavaLanguageLevelPusher implements FilePropertyPusher<LanguageLevel
     DataInputOutputUtil.writeINT(oStream, level.ordinal());
     oStream.close();
 
     DataInputOutputUtil.writeINT(oStream, level.ordinal());
     oStream.close();
 
-    PushedFilePropertiesUpdater.getInstance(project).filePropertiesChanged(fileOrDir, f -> isJavaLike(f.getFileType()));
+    // Todo: GwtLanguageLevelPusher changes java language level for single files without firing filePropertiesChanged
+    // so code below doesn't work.
+    // Uncomment it and remove older code once the problem is fixed
+    //PushedFilePropertiesUpdater.getInstance(project).filePropertiesChanged(fileOrDir, f -> isJavaLike(f.getFileType()));
+
+    for (VirtualFile child : fileOrDir.getChildren()) {
+      if (!child.isDirectory() && isJavaLike(child.getFileType())) {
+        PushedFilePropertiesUpdater.getInstance(project).filePropertiesChanged(child);
+      }
+    }
   }
 
   private static boolean isJavaLike(FileType type) {
   }
 
   private static boolean isJavaLike(FileType type) {