Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2015-07-31 18:08:17 -0400
committerAlex Blewitt2015-09-03 06:21:11 -0400
commit9d920dc184c0ea2271a9f088d1af6f52df1b4eed (patch)
tree6022f848e592ea43b840222a49ea0304f00c722e /org.eclipse.debug.tests
parent678c63a96bd3bce570a62beb5546ca0b29d608a0 (diff)
downloadeclipse.platform.debug-9d920dc184c0ea2271a9f088d1af6f52df1b4eed.tar.gz
eclipse.platform.debug-9d920dc184c0ea2271a9f088d1af6f52df1b4eed.tar.xz
eclipse.platform.debug-9d920dc184c0ea2271a9f088d1af6f52df1b4eed.zip
Bug 474074 - Replace new Boolean with Boolean.valueOfI20150908-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 `new Boolean(...).booleanValue()` to `Boolean.parseBoolean(...)`. Change-Id: I95bed6f2af0293c20d1ac7076ca151b85d1f962d Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Diffstat (limited to 'org.eclipse.debug.tests')
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java
index 792c3745a..9959c5d06 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/viewer/model/PresentationContextTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 Wind River Systems and others.
+ * Copyright (c) 2008, 2015 Wind River Systems 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
@@ -36,7 +36,7 @@ public class PresentationContextTests extends TestCase {
PresentationContext context = new PresentationContext("test"); //$NON-NLS-1$
context.setProperty("string", "string"); //$NON-NLS-1$ //$NON-NLS-2$
context.setProperty("integer", new Integer(1)); //$NON-NLS-1$
- context.setProperty("boolean", new Boolean(true)); //$NON-NLS-1$
+ context.setProperty("boolean", Boolean.TRUE); //$NON-NLS-1$
context.setProperty("persistable", ResourcesPlugin.getWorkspace().getRoot().getAdapter(IPersistableElement.class)); //$NON-NLS-1$
final XMLMemento memento = XMLMemento.createWriteRoot("TEST"); //$NON-NLS-1$
@@ -46,7 +46,7 @@ public class PresentationContextTests extends TestCase {
context.initProperties(memento);
assertEquals("Wrong value restored", "string", context.getProperty("string")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
assertEquals("Wrong value restored", new Integer(1), context.getProperty("integer")); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong value restored", new Boolean(true), context.getProperty("boolean")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Wrong value restored", Boolean.TRUE, context.getProperty("boolean")); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Wrong value restored", ResourcesPlugin.getWorkspace().getRoot(), context.getProperty("persistable")); //$NON-NLS-1$ //$NON-NLS-2$
context.dispose();
}

Back to the top