diff options
author | Alex Blewitt | 2016-03-16 01:30:35 +0000 |
---|---|---|
committer | Alex Blewitt | 2016-04-19 08:34:01 +0000 |
commit | bff55f297a5c1f61add01419da9671cfea908c46 (patch) | |
tree | c1438bc3be529485b3965a66c4a4cc1893d2320c /bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2 | |
parent | 30aa50233fe07edc71b6729f7690454170215932 (diff) | |
download | rt.equinox.p2-bff55f297a5c1f61add01419da9671cfea908c46.tar.gz rt.equinox.p2-bff55f297a5c1f61add01419da9671cfea908c46.tar.xz rt.equinox.p2-bff55f297a5c1f61add01419da9671cfea908c46.zip |
Bug 489706 - Replace new Integer() with Integer.valueOf()I20160419-0800
There are a lot of new Integer() calls in the P2 codebase, which results
in many duplicate values of Integer being stored, particularly when
performing updates or checks. Integer.valueOf() performs this caching
already, which means that it's unnecessary to call new Integer() and
instead can call Integer.valueOf(). In the places where the int value is
being used directly, the call can be further optimised to
Integer.parseInt() instead.
Replace calls to new Integer() with Integer.valueOf() or .parseInt()
as appropriate.
Change-Id: Ic760e66084c856fc90cb7c8a358007c975213638
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2')
2 files changed, 5 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java index b3de83058..851e491f4 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 IBM Corporation and others. + * Copyright (c) 2008, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -74,7 +74,7 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes // register alternate services SimpleLicenseManager manager = new SimpleLicenseManager(TESTPROFILE); Dictionary<String, Object> properties = new Hashtable<String, Object>(5); - properties.put(Constants.SERVICE_RANKING, new Integer(1)); + properties.put(Constants.SERVICE_RANKING, Integer.valueOf(1)); regLicenseManager = TestActivator.getContext().registerService(LicenseManager.class.getName(), manager, properties); profileElement = new ProfileElement(null, TESTPROFILE); @@ -132,7 +132,7 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes req.setInstallableUnitProfileProperty(iu, IProfile.PROP_PROFILE_ROOT_IU, Boolean.toString(true)); } if (lock) { - req.setInstallableUnitProfileProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU, new Integer(IProfile.LOCK_UNINSTALL | IProfile.LOCK_UPDATE).toString()); + req.setInstallableUnitProfileProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU, Integer.valueOf(IProfile.LOCK_UNINSTALL | IProfile.LOCK_UPDATE).toString()); } // Use an empty provisioning context to prevent repo access ProvisioningContext context = new ProvisioningContext(getAgent()); diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java index 1b8905e80..308e0b6cc 100644 --- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 IBM Corporation and others. + * Copyright (c) 2008, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -81,7 +81,7 @@ public class RemediationTest extends WizardTest { // register alternate services SimpleLicenseManager manager = new SimpleLicenseManager(name); Dictionary<String, Object> properties = new Hashtable<String, Object>(5); - properties.put(Constants.SERVICE_RANKING, new Integer(1)); + properties.put(Constants.SERVICE_RANKING, Integer.valueOf(1)); regLicenseManager = TestActivator.getContext().registerService(LicenseManager.class.getName(), manager, properties); profileElement = new ProfileElement(null, name); IULoader.loadIUs(this); |