util: specify nullability, avoid map allocation if possible, update deprecated method...
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Sat, 8 Oct 2016 10:11:24 +0000 (13:11 +0300)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Sat, 8 Oct 2016 10:11:24 +0000 (13:11 +0300)
platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java

index d5a75ed3b5fa4714692d6780585c6cba83140dde..d935edfba49260358c51a6e27ab9c95887b384ba 100644 (file)
@@ -180,12 +180,12 @@ public class GeneralCommandLine implements UserDataHolder {
     return myParentEnvironmentType != ParentEnvironmentType.NONE;
   }
 
-  /** @deprecated use {@link #withParentEnvironmentType(ParentEnvironmentType)} (to be removed in IDEA 17) */
+  /** @deprecated use {@link #withParentEnvironmentType(ParentEnvironmentType)} */
   public GeneralCommandLine withPassParentEnvironment(boolean passParentEnvironment) {
     return withParentEnvironmentType(passParentEnvironment ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);
   }
 
-  /** @deprecated use {@link #withParentEnvironmentType(ParentEnvironmentType)} (to be removed in IDEA 17) */
+  /** @deprecated use {@link #withParentEnvironmentType(ParentEnvironmentType)} */
   public void setPassParentEnvironment(boolean passParentEnvironment) {
     withParentEnvironmentType(passParentEnvironment ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);
   }
@@ -424,6 +424,7 @@ public class GeneralCommandLine implements UserDataHolder {
     return myExePath + " " + myProgramParams;
   }
 
+  @Nullable
   @Override
   public <T> T getUserData(@NotNull Key<T> key) {
     if (myUserData != null) {
@@ -436,6 +437,7 @@ public class GeneralCommandLine implements UserDataHolder {
   @Override
   public <T> void putUserData(@NotNull Key<T> key, @Nullable T value) {
     if (myUserData == null) {
+      if (value == null) return;
       myUserData = ContainerUtil.newHashMap();
     }
     myUserData.put(key, value);