diff options
author | Alex Blewitt | 2015-09-06 16:13:21 +0000 |
---|---|---|
committer | Alex Blewitt | 2015-09-07 21:49:13 +0000 |
commit | e3e578c98878b6e5bc8b9140389ffe36c5651b56 (patch) | |
tree | 6c22e2cf834d3c6a267611f2d59b9d1c45511c90 /bundles/org.eclipse.equinox.simpleconfigurator | |
parent | 4c1b71edc5f460ce4dc183f592449b24dbe53c97 (diff) | |
download | rt.equinox.p2-e3e578c98878b6e5bc8b9140389ffe36c5651b56.tar.gz rt.equinox.p2-e3e578c98878b6e5bc8b9140389ffe36c5651b56.tar.xz rt.equinox.p2-e3e578c98878b6e5bc8b9140389ffe36c5651b56.zip |
Bug 476724 - Remove new Boolean and Boolean.valueOf().booleanValue()I20150929-0800I20150922-0800I20150916-2000I20150916-0800I20150915-2000I20150915-0800I20150914-2000I20150914-1545I20150914-1130I20150914-0800I20150913-2000I20150908-0800
The new Boolean constructor creates a new instance of a Boolean object, but it
can easily be replaced with Boolean.valueOf which returns the reference to the
global Boolean.TRUE or Boolean.FALSE. Replace calls to new Boolean() with
Boolean.valueOf() for identical semantics except without object collection.
Additionally Boolean.valueOf().booleanValue() is identical to
Boolean.parseBoolean() and will result in no garbage. In addition, methods will
be (slightly) smaller and parseBoolean will often be in-lined by the JIT, which
can often prove that the value is non-null for faster checking. Replace
Boolean.valueOf().booleanValue() chains with Boolean.parseBoolean().
Some other tests can use Wrapper.valueOf() to take advantage of the built-in
caches that these objects maintain (for values in the range -128..127).
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Change-Id: I5da4216a26ffbb6b8fd3365515ee800dd82b36ae
Diffstat (limited to 'bundles/org.eclipse.equinox.simpleconfigurator')
4 files changed, 8 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java index 4a3a25745..94355c254 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java @@ -287,7 +287,7 @@ class ConfigApplier { ArrayList<Bundle> toRefresh = new ArrayList<Bundle>(); String useReferenceProperty = manipulatingContext.getProperty(SimpleConfiguratorConstants.PROP_KEY_USE_REFERENCE); - boolean useReference = useReferenceProperty == null ? runningOnEquinox : Boolean.valueOf(useReferenceProperty).booleanValue(); + boolean useReference = useReferenceProperty == null ? runningOnEquinox : Boolean.parseBoolean(useReferenceProperty); for (int i = 0; i < finalList.length; i++) { if (finalList[i] == null) diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java index b888f29b1..5c68ab0a4 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 IBM Corporation and others. + * Copyright (c) 2007, 2015 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 @@ -196,7 +196,7 @@ public class SimpleConfiguratorImpl implements Configurator { String value = context.getProperty(SimpleConfiguratorConstants.PROP_KEY_EXCLUSIVE_INSTALLATION); if (value == null || value.trim().length() == 0) value = "true"; - return Boolean.valueOf(value).booleanValue(); + return Boolean.parseBoolean(value); } public void applyConfiguration() throws IOException { diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/console/ConfiguratorCommandProvider.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/console/ConfiguratorCommandProvider.java index 77106d257..a61a9faea 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/console/ConfiguratorCommandProvider.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/console/ConfiguratorCommandProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 IBM Corporation and others. + * Copyright (c) 2007, 2015 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 @@ -61,14 +61,14 @@ public class ConfiguratorCommandProvider implements CommandProvider { public Object _help(CommandInterpreter intp) { String commandName = intp.nextArgument(); if (commandName == null) { - return new Boolean(false); + return Boolean.FALSE; } String help = getHelp(commandName); if (help.length() > 0) { return help; } - return new Boolean(false); + return Boolean.FALSE; } public String getHelp() { diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java index ab69b8856..e5ceced3b 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 IBM Corporation and others. All rights reserved. + * Copyright (c) 2007, 2015 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 http://www.eclipse.org/legal/epl-v10.html @@ -284,7 +284,7 @@ public class SimpleConfiguratorUtils { String version = tok.nextToken().trim(); URI location = parseLocation(tok.nextToken().trim()); int startLevel = Integer.parseInt(tok.nextToken().trim()); - boolean markedAsStarted = Boolean.valueOf(tok.nextToken()).booleanValue(); + boolean markedAsStarted = Boolean.parseBoolean(tok.nextToken()); BundleInfo result = new BundleInfo(symbolicName, version, location, startLevel, markedAsStarted); if (!location.isAbsolute()) result.setBaseLocation(base); |