Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2015-06-18 18:55:01 +0000
committerAlex Blewitt2015-07-06 07:46:20 +0000
commit9ee96387c3c9b80f76fa76476f4d0fa5764f4919 (patch)
tree20a3db893b2db4503ac53222599a72ca3ef7d210 /bundles/org.eclipse.equinox.cm.test
parentbde007b013512c536e1e8c5b616961a6a0140347 (diff)
downloadrt.equinox.bundles-9ee96387c3c9b80f76fa76476f4d0fa5764f4919.tar.gz
rt.equinox.bundles-9ee96387c3c9b80f76fa76476f4d0fa5764f4919.tar.xz
rt.equinox.bundles-9ee96387c3c9b80f76fa76476f4d0fa5764f4919.zip
Bug 470518 - Replace `new Boolean` with `Boolean.valueOf`
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. Bug: 470518 Change-Id: I25742c65162e57fd553dd1284ec057cd4b333dbb Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.cm.test')
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationDictionaryTest.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationDictionaryTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationDictionaryTest.java
index 7044a7e45..f4bdbb44f 100644
--- a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationDictionaryTest.java
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationDictionaryTest.java
@@ -52,7 +52,7 @@ public class ConfigurationDictionaryTest extends TestCase {
dict.put("6", new Byte((byte) 1));
dict.put("7", new Short((short) 1));
dict.put("8", new Character('a'));
- dict.put("9", new Boolean(true));
+ dict.put("9", Boolean.TRUE);
dict.put("10", new String[] {"x"});
dict.put("11", new Integer[] {new Integer(1)});
dict.put("12", new Long[] {new Long(1)});
@@ -61,7 +61,7 @@ public class ConfigurationDictionaryTest extends TestCase {
dict.put("15", new Byte[] {new Byte((byte) 1)});
dict.put("16", new Short[] {new Short((short) 1)});
dict.put("17", new Character[] {new Character('a')});
- dict.put("18", new Boolean[] {new Boolean(true)});
+ dict.put("18", new Boolean[] {Boolean.TRUE});
dict.put("19", new int[] {1});
dict.put("20", new long[] {1});
dict.put("21", new float[] {1});
@@ -80,7 +80,7 @@ public class ConfigurationDictionaryTest extends TestCase {
v.add(new Byte((byte) 1));
v.add(new Short((short) 1));
v.add(new Character('a'));
- v.add(new Boolean(true));
+ v.add(Boolean.TRUE);
dict.put("28", v);
Collection c = new ArrayList();
c.add(new String("x"));
@@ -91,7 +91,7 @@ public class ConfigurationDictionaryTest extends TestCase {
c.add(new Byte((byte) 1));
c.add(new Short((short) 1));
c.add(new Character('a'));
- c.add(new Boolean(true));
+ c.add(Boolean.TRUE);
dict.put("29", c);
} catch (IllegalArgumentException e) {
fail(e.getMessage());

Back to the top