[java] Using native Java facilities to create a shallow copy of a map
package org.openqa.selenium.os;
import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.collect.ImmutableMap.copyOf;
+import static java.util.Collections.unmodifiableMap;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.openqa.selenium.Platform.WINDOWS;
-import com.google.common.annotations.VisibleForTesting;
-
import org.apache.commons.exec.DaemonExecutor;
import org.apache.commons.exec.DefaultExecuteResultHandler;
import org.apache.commons.exec.ExecuteWatchdog;
@@ -78,9 +76,8 @@ public void setEnvironmentVariable(String name, String value) {
env.put(name, value);
}
- @VisibleForTesting
public Map<String, String> getEnvironment() {
- return copyOf(env);
+ return unmodifiableMap(new HashMap<>(env));
}
private Map<String, String> getMergedEnv() {
