Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2015-06-19 09:18:40 +0000
committerAlexander Kurtakov2015-07-07 08:57:27 +0000
commit4976c78e1f8140ee2ccd13db6f6d574e844114ee (patch)
treed658c0ffa9375a6c72f433716193d8c72fd7f52f /bundles/org.eclipse.swt/Eclipse SWT AWT
parent9c11c60b1c468edeb1c6ccb338da886f4e4c9b77 (diff)
downloadeclipse.platform.swt-4976c78e1f8140ee2ccd13db6f6d574e844114ee.tar.gz
eclipse.platform.swt-4976c78e1f8140ee2ccd13db6f6d574e844114ee.tar.xz
eclipse.platform.swt-4976c78e1f8140ee2ccd13db6f6d574e844114ee.zip
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 <alex.blewitt@gmail.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT AWT')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java4
2 files changed, 5 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java
index 2900d42139..49eab7f89f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java
@@ -282,7 +282,7 @@ public static Frame new_Frame(final Composite parent) {
try {
Class clazz = frame.getClass();
Method method = clazz.getMethod("synthesizeWindowActivation", new Class[]{boolean.class});
- if (method != null) method.invoke(frame, new Object[]{new Boolean(true)});
+ if (method != null) method.invoke(frame, new Object[]{Boolean.TRUE});
} catch (Throwable e) {e.printStackTrace();}
}
});
@@ -295,7 +295,7 @@ public static Frame new_Frame(final Composite parent) {
try {
Class clazz = frame.getClass();
Method method = clazz.getMethod("synthesizeWindowActivation", new Class[]{boolean.class});
- if (method != null) method.invoke(frame, new Object[]{new Boolean(false)});
+ if (method != null) method.invoke(frame, new Object[]{Boolean.FALSE});
} catch (Throwable e) {e.printStackTrace();}
}
});
@@ -393,4 +393,4 @@ public static Shell new_Shell(final Display display, final Canvas parent) {
shell.setVisible (true);
return shell;
}
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java
index 1df6377355..70b1dd2bca 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java
@@ -289,7 +289,7 @@ public static Frame new_Frame (final Composite parent) {
try {
Class clazz = frame.getClass();
Method method = clazz.getMethod("synthesizeWindowActivation", new Class[]{boolean.class});
- if (method != null) method.invoke(frame, new Object[]{new Boolean(true)});
+ if (method != null) method.invoke(frame, new Object[]{Boolean.TRUE});
} catch (Throwable e) {}
}
}
@@ -309,7 +309,7 @@ public static Frame new_Frame (final Composite parent) {
try {
Class clazz = frame.getClass();
Method method = clazz.getMethod("synthesizeWindowActivation", new Class[]{boolean.class});
- if (method != null) method.invoke(frame, new Object[]{new Boolean(false)});
+ if (method != null) method.invoke(frame, new Object[]{Boolean.FALSE});
} catch (Throwable e) {}
}
}

Back to the top