From 9d920dc184c0ea2271a9f088d1af6f52df1b4eed Mon Sep 17 00:00:00 2001 From: Alex Blewitt Date: Fri, 31 Jul 2015 23:08:17 +0100 Subject: Bug 474074 - 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 `new Boolean(...).booleanValue()` to `Boolean.parseBoolean(...)`. Change-Id: I95bed6f2af0293c20d1ac7076ca151b85d1f962d Signed-off-by: Alex Blewitt --- .../eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'org.eclipse.ui.externaltools') diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java index 483b652c6..a0bd3a0f9 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/ui/BuilderPropertyPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -874,8 +874,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta String val = command.getArguments().get(COMMAND_ENABLED); if(val != null) { //null means enabled, see #doPerformOk - Boolean enabled = new Boolean(val); - return enabled.booleanValue(); + return Boolean.parseBoolean(val); } } else if (element instanceof ILaunchConfiguration) { try { @@ -996,8 +995,7 @@ public final class BuilderPropertyPage extends PropertyPage implements ICheckSta Map args = command.getArguments(); String val = args.get(COMMAND_ENABLED); if(val != null) { - Boolean enabled = new Boolean(val); - if (!enabled.booleanValue()) { + if (!Boolean.parseBoolean(val)) { ILaunchConfiguration config= disableCommand(command); if (config != null) { data= BuilderUtils.commandFromLaunchConfig(project,config); -- cgit v1.2.3