From 4976c78e1f8140ee2ccd13db6f6d574e844114ee Mon Sep 17 00:00:00 2001 From: Alex Blewitt Date: Fri, 19 Jun 2015 10:18:40 +0100 Subject: Bug 470568 - 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: 470568 Change-Id: I0a9abceef0032f92581f381c36d9971457c3fdee Signed-off-by: Alex Blewitt --- .../JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java | 2 +- .../JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'bundles/org.eclipse.swt.tools') diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java index c44606a1f4..512f069d85 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ASTMethod.java @@ -128,7 +128,7 @@ public boolean isNativeUnique() { break; } } - unique = new Boolean(result); + unique = Boolean.valueOf(result); return result; } diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java index 67bcb0db77..d8ad18c9d5 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/ReflectMethod.java @@ -138,7 +138,7 @@ public boolean isNativeUnique() { break; } } - unique = new Boolean(result); + unique = Boolean.valueOf(result); return result; } -- cgit v1.2.3