fireProfileChanged — restore old behavior — profile is nullable
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Wed, 13 Jul 2016 08:26:49 +0000 (10:26 +0200)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Wed, 13 Jul 2016 08:26:49 +0000 (10:26 +0200)
java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java
platform/analysis-api/src/com/intellij/profile/ProfileChangeAdapter.java
platform/analysis-impl/src/com/intellij/profile/codeInspection/BaseInspectionProfileManager.kt
platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java

index 9d23670141ddaf8773fcb6ccf71dd72ca17837c2..c9c8a47b8461b704c29e74964a835dae12c83032 100644 (file)
@@ -81,7 +81,7 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
   protected final Project myProject;
   private long myLastModificationCount = -1;
 
-  public EntryPointsManagerBase(final Project project) {
+  public EntryPointsManagerBase(@NotNull Project project) {
     myProject = project;
     myTemporaryEntryPoints = new HashSet<RefElement>();
     myPersistentEntryPoints = new LinkedHashMap<String, SmartRefElementPointer>(); // To keep the order between readExternal to writeExternal
@@ -97,11 +97,13 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
         if (ADDITIONAL_ANNOS != null) {
           ADDITIONAL_ANNOS = null;
           UIUtil.invokeLaterIfNeeded(() -> {
-            if (ApplicationManager.getApplication().isDisposed()) return;
-            InspectionProfileManager.getInstance().fireProfileChanged(null);
+            if (!ApplicationManager.getApplication().isDisposed()) {
+              InspectionProfileManager.getInstance().fireProfileChanged(null);
+            }
           });
         }
-        DaemonCodeAnalyzer.getInstance(project).restart(); // annotations changed
+        // annotations changed
+        DaemonCodeAnalyzer.getInstance(myProject).restart();
       }
     }, false, this);
   }
@@ -206,8 +208,8 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
       }
       else if (refConstructors.size() > 1) {
         // Many constructors here. Need to ask user which ones are used
-        for (int i = 0; i < refConstructors.size(); i++) {
-          addEntryPoint(refConstructors.get(i), isPersistent);
+        for (RefMethod refConstructor : refConstructors) {
+          addEntryPoint(refConstructor, isPersistent);
         }
       }
     }
index 026237adca819babbc0b076e810c19ce402bbde9..e45fe64fdd0e6e85146bc070c2c8283e22bf6879 100644 (file)
@@ -18,7 +18,7 @@ package com.intellij.profile;
 import org.jetbrains.annotations.Nullable;
 
 public interface ProfileChangeAdapter {
-  default void profileChanged(Profile profile) {
+  default void profileChanged(@Nullable Profile profile) {
   }
 
   default void profileActivated(@Nullable Profile oldProfile, @Nullable Profile profile) {
index 75227d744d048065c36465b45e276ab7e3903da7..bdc78a7662ca412878456ad7165a200abb1075e9 100644 (file)
@@ -64,7 +64,7 @@ abstract class BaseInspectionProfileManager(messageBus: MessageBus) :  Inspectio
     }
   }
 
-  override final fun fireProfileChanged(profile: Profile) {
+  override final fun fireProfileChanged(profile: Profile?) {
     if (profile is InspectionProfileImpl) {
       profile.profileChanged()
     }
index 6b8187a7ced27f17e8f2ecc97a1657a1533313ec..a6850e29a621440f578a0e81f7d9183f4547cec6 100644 (file)
@@ -44,7 +44,7 @@ public interface InspectionProfileManager extends ProfileManager, SeverityProvid
   @SuppressWarnings("unused")
   void removeProfileChangeListener(@NotNull ProfileChangeAdapter listener);
 
-  void fireProfileChanged(@NotNull Profile profile);
+  void fireProfileChanged(@Nullable Profile profile);
 
   void fireProfileChanged(@Nullable Profile oldProfile, @NotNull Profile profile);