diff options
author | Alex Blewitt | 2015-06-17 08:31:18 +0000 |
---|---|---|
committer | Alex Blewitt | 2015-07-31 08:29:48 +0000 |
commit | daa59ae7f9eec005b257ef65c0361228e8fc34ec (patch) | |
tree | 299133a209f1e37630c0f3e3b1fc96f5d3ed4186 /bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team | |
parent | d4eadcca6620f0c222b2b101ca33f13d2fe92176 (diff) | |
download | eclipse.platform.team-daa59ae7f9eec005b257ef65c0361228e8fc34ec.tar.gz eclipse.platform.team-daa59ae7f9eec005b257ef65c0361228e8fc34ec.tar.xz eclipse.platform.team-daa59ae7f9eec005b257ef65c0361228e8fc34ec.zip |
Bug 470344 - 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. In-line
`Boolean.valueOf(true)` with `Boolean.TRUE`, c.f. false.
Bug: 470344
Change-Id: I673669144881f738006b8567e99e5760e851ad07
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team')
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IEditorInputTester.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IEditorInputTester.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IEditorInputTester.java index 1fd1cd2a7..457904b69 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IEditorInputTester.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IEditorInputTester.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Alex Blewitt <alex.blewitt@gmail.com> - replace new Boolean with Boolean.valueOf - https://bugs.eclipse.org/470344 *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui; @@ -33,11 +34,11 @@ public class IEditorInputTester extends PropertyTester { ICVSResource cvsResource = CVSWorkspaceRoot .getCVSResourceFor(file); try { - actual = new Boolean((cvsResource != null + actual = Boolean.valueOf((cvsResource != null && !cvsResource.isFolder() && cvsResource .isManaged())); } catch (CVSException e) { - actual = new Boolean(isEnabledForException(e)); + actual = Boolean.valueOf(isEnabledForException(e)); } return (actual.equals(expectedValue)); } |