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.p2.repository | |
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.p2.repository')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java index 548958307..20c0bfb98 100644 --- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java +++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java @@ -128,7 +128,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager info.location = repository.getLocation(); String value = repository.getProperties().get(IRepository.PROP_SYSTEM); if (value != null) - info.isSystem = Boolean.valueOf(value).booleanValue(); + info.isSystem = Boolean.parseBoolean(value); info.suffix = suffix; } // save the given repository in the preferences. @@ -597,7 +597,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager info.nickname = value; else if (IRepository.PROP_SYSTEM.equals(key)) //only true if value.equals("true") which is OK because a repository is only system if it's explicitly set to system. - info.isSystem = Boolean.valueOf(value).booleanValue(); + info.isSystem = Boolean.parseBoolean(value); remember(info, true); } } @@ -683,7 +683,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager if (added) removeRepository(location, false); //eagerly cleanup missing system repositories - if (Boolean.valueOf(getRepositoryProperty(location, IRepository.PROP_SYSTEM)).booleanValue()) + if (Boolean.parseBoolean(getRepositoryProperty(location, IRepository.PROP_SYSTEM))) removeRepository(location); else if (failure == null || (failure.getStatus().getCode() != ProvisionException.REPOSITORY_FAILED_AUTHENTICATION && failure.getStatus().getCode() != ProvisionException.REPOSITORY_FAILED_READ)) rememberNotFound(location); |