Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2015-06-18 21:49:38 +0000
committerThomas Watson2015-07-09 16:17:28 +0000
commit7f7ccacb8f5c6966406bef59aaf350a336f2891e (patch)
treef7bccf23d0d15e0f143438c0ab538da0184083e2 /bundles/org.eclipse.osgi.compatibility.state
parentbf1f2a7f4639ef15279e17d372b2703cde1408fe (diff)
downloadrt.equinox.framework-7f7ccacb8f5c6966406bef59aaf350a336f2891e.tar.gz
rt.equinox.framework-7f7ccacb8f5c6966406bef59aaf350a336f2891e.tar.xz
rt.equinox.framework-7f7ccacb8f5c6966406bef59aaf350a336f2891e.zip
Bug 470527 - Replace `new Boolean` with `Boolean.valueOf`I20150714-0800
Using `new Boolean()` results in the creation of a new object on the heap, when the flyweight `Boolean.TRUE` and `Boolean.FALSE` are available. Java 1.4 added a `Boolean.valueOf()` which can be used in place of `new Boolean()` but which will use the existing flyweight values instead. Globally change `new Boolean(...)` to `Boolean.valueOf(...)` and replace constant valued expressions with their flyweight counterparts. Defer changes to `org.osgi.util.xml.XMLParserActivator` to upstream OSGi. Bug: 470527 Change-Id: I122e4456a49e8eee9d88db0a3237f7e6b19a8469 Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.osgi.compatibility.state')
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
index 8d754739c..29f4e2b26 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
@@ -620,7 +620,7 @@ class RequiresHolder {
// Get the visibility of all directly required bundles
for (int i = 0; i < required.length; i++) {
if (required[i].getSupplier() != null) {
- resolvedBundlesExported.put((BundleDescription) required[i].getSupplier(), new Boolean(required[i].isExported()));
+ resolvedBundlesExported.put((BundleDescription) required[i].getSupplier(), Boolean.valueOf(required[i].isExported()));
resolved.remove(required[i].getSupplier());
}
}
@@ -633,7 +633,7 @@ class RequiresHolder {
BundleSpecification[] fragmentRequiredBundles = fragments[i].getRequiredBundles();
for (int j = 0; j < fragmentRequiredBundles.length; j++) {
if (resolved.contains(fragmentRequiredBundles[j].getSupplier())) {
- resolvedBundlesExported.put((BundleDescription) fragmentRequiredBundles[j].getSupplier(), new Boolean(fragmentRequiredBundles[j].isExported()));
+ resolvedBundlesExported.put((BundleDescription) fragmentRequiredBundles[j].getSupplier(), Boolean.valueOf(fragmentRequiredBundles[j].isExported()));
resolved.remove(fragmentRequiredBundles[j].getSupplier());
}
}

Back to the top