diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/AbstractBundleContainer.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/AbstractBundleContainer.java index a66eb88cbe..82c4413bc8 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/AbstractBundleContainer.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/AbstractBundleContainer.java @@ -17,7 +17,6 @@ import java.io.File; import java.io.IOException; import java.util.HashMap; -import java.util.Map.Entry; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; @@ -66,7 +65,7 @@ public abstract class AbstractBundleContainer extends PlatformObject implements */ private String[] fVMArgs; - static private HashMap hash = new HashMap<>(); + private static final HashMap fVMArgsCache = new HashMap<>(); /** * Resolves any string substitution variables in the given text returning @@ -223,11 +222,11 @@ protected void clearResolutionStatus() { @Override public String[] getVMArguments() { - for (Entry entry : hash.entrySet()) { - if (entry.getKey().equals(this)) { - return entry.getValue(); - } + String[] cachedArgs = fVMArgsCache.get(this); + if (cachedArgs != null) { + return cachedArgs; } + String FWK_ADMIN_EQ = "org.eclipse.equinox.frameworkadmin.equinox"; //$NON-NLS-1$ if (fVMArgs == null) { try { @@ -261,10 +260,10 @@ public String[] getVMArguments() { } if (fVMArgs == null || fVMArgs.length == 0) { - hash.put(this, null); + fVMArgsCache.put(this, null); return null; } - hash.put(this, fVMArgs); + fVMArgsCache.put(this, fVMArgs); return fVMArgs; }