diff options
author | Nikita Nemkin | 2019-03-28 06:02:55 +0000 |
---|---|---|
committer | Lars Vogel | 2019-04-02 11:02:53 +0000 |
commit | ddbca2fae9f058b3a86228884dd39a0b6951bc2a (patch) | |
tree | b25b9abd5c2e79b23ae5637aab845eeb9a142e52 /bundles | |
parent | a352fe3d2cc4c9803306f45213aea789cf998600 (diff) | |
download | eclipse.platform.swt-ddbca2fae9f058b3a86228884dd39a0b6951bc2a.tar.gz eclipse.platform.swt-ddbca2fae9f058b3a86228884dd39a0b6951bc2a.tar.xz eclipse.platform.swt-ddbca2fae9f058b3a86228884dd39a0b6951bc2a.zip |
Fix Java 9 deprecation warnings
Boolean/Integer/Long/Double constructors were deprecated in Java 9.
Change-Id: I30d054db50310de6b2ca4457d2548851b2e5e789
Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
Diffstat (limited to 'bundles')
12 files changed, 26 insertions, 28 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 fa3524d47a..b9f69a5938 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 @@ -178,7 +178,7 @@ public static Frame new_Frame(final Composite parent) { EventQueue.invokeLater(runnable); Display display = parent.getDisplay(); while (result[0] == null && exception[0] == null) { - display.setData(RUN_AWT_INVOKE_LATER_KEY, new Boolean (true)); + display.setData(RUN_AWT_INVOKE_LATER_KEY, true); Boolean invoked = (Boolean)display.getData(RUN_AWT_INVOKE_LATER_KEY); if (invoked != null && !invoked.booleanValue()) { runnable.run(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java index 143d8269c9..0c0e6409a8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java @@ -1454,7 +1454,7 @@ public boolean setText(final String html, boolean trusted) { * to ensure that all expected client events are sent. */ if (performingInitialNavigate) { - pendingText = new Object[] {html, new Boolean (trusted)}; + pendingText = new Object[] {html, trusted}; pendingUrl = null; return true; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java index 7e46b73010..a519c655f2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java @@ -857,13 +857,13 @@ Object convertToJava (Variant variant) { case OLE.VT_EMPTY: case OLE.VT_NULL: return null; case OLE.VT_BSTR: return variant.getString (); - case OLE.VT_BOOL: return new Boolean (variant.getBoolean ()); + case OLE.VT_BOOL: return variant.getBoolean (); case OLE.VT_I2: case OLE.VT_I4: case OLE.VT_I8: case OLE.VT_R4: case OLE.VT_R8: - return new Double (variant.getDouble ()); + return variant.getDouble (); case OLE.VT_DISPATCH: { Object[] args = null; OleAutomation auto = variant.getAutomation (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java index 4a57f1d153..26ba98c379 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/win32/org/eclipse/swt/opengl/GLCanvas.java @@ -47,7 +47,7 @@ public class GLCanvas extends Canvas { */ public GLCanvas (Composite parent, int style, GLData data) { super (parent, checkStyle (parent, style)); - parent.getDisplay ().setData (USE_OWNDC_KEY, new Boolean (false)); + parent.getDisplay ().setData (USE_OWNDC_KEY, false); if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); PIXELFORMATDESCRIPTOR pfd = new PIXELFORMATDESCRIPTOR (); pfd.nSize = (short) PIXELFORMATDESCRIPTOR.sizeof; @@ -108,7 +108,7 @@ public GLCanvas (Composite parent, int style, GLData data) { static int checkStyle(Composite parent, int style) { if (parent != null) { - parent.getDisplay ().setData (USE_OWNDC_KEY, new Boolean (true)); + parent.getDisplay ().setData (USE_OWNDC_KEY, true); } return style; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java index b9919645a5..7f2eccdac7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/cocoa/org/eclipse/swt/browser/WebKit.java @@ -1708,10 +1708,10 @@ Object convertToJava (long /*int*/ value) { byte[] type = new byte[1]; C.memmove (type, ptr, 1); if (type[0] == 'c' || type[0] == 'B') { - return new Boolean (number.boolValue ()); + return number.boolValue (); } if ("islqISLQfd".indexOf (type[0]) != -1) { //$NON-NLS-1$ - return new Double (number.doubleValue ()); + return number.doubleValue (); } } clazz = OS.objc_lookUpClass ("WebScriptObject"); //$NON-NLS-1$ @@ -1774,7 +1774,7 @@ NSObject callJava (long /*int*/ index, long /*int*/ token, long /*int*/ args, lo long /*int*/ clazz = OS.objc_lookUpClass ("NSNumber"); //$NON-NLS-1$ if (object.isKindOfClass (clazz)) { NSNumber number = new NSNumber (index); - Object key = new Integer (number.intValue ()); + Object key = number.intValue (); object = new NSObject (token); clazz = OS.objc_lookUpClass ("NSString"); //$NON-NLS-1$ if (object.isKindOfClass (clazz)) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java index a789deac01..9491018625 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java @@ -2722,7 +2722,7 @@ void openDownloadWindow (final long webkitDownload, final String suggested_filen long response = WebKitGTK.webkit_download_get_response(webkitDownload); total = WebKitGTK.webkit_uri_response_get_content_length(response) / 1024L; } - String message = Compatibility.getMessage ("SWT_Download_Status", new Object[] {Long.valueOf(current), new Long(total)}); //$NON-NLS-1$ + String message = Compatibility.getMessage ("SWT_Download_Status", new Object[] {current, total}); //$NON-NLS-1$ statusLabel.setText (message); display.timerExec (INTERVAL, this); } @@ -3868,13 +3868,12 @@ long callJava (long ctx, long func, long thisObject, long argumentCount, long ar if (type == WebKitGTK.kJSTypeNumber) { int index = ((Double)convertToJava (ctx, result[0])).intValue (); result[0] = 0; - Integer key = new Integer (index); // 2nd arg: function token C.memmove (result, arguments + C.PTR_SIZEOF, C.PTR_SIZEOF); type = WebKitGTK.JSValueGetType (ctx, result[0]); if (type == WebKitGTK.kJSTypeString) { String token = (String)convertToJava (ctx, result[0]); - BrowserFunction function = functions.get (key); + BrowserFunction function = functions.get (index); if (function != null && token.equals (function.token)) { try { // 3rd Arg: paramaters given from Javascript @@ -3941,7 +3940,7 @@ static Object convertToJava (long ctx, long value) { switch (type) { case WebKitGTK.kJSTypeBoolean: { int result = (int)WebKitGTK.JSValueToNumber (ctx, value, null); - return new Boolean (result != 0); + return result != 0; } case WebKitGTK.kJSTypeNumber: { double result = WebKitGTK.JSValueToNumber (ctx, value, null); diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java index 17d0802672..f931db5cc8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebkitGDBus.java @@ -515,7 +515,7 @@ class WebkitGDBus { private static Object convertGVariantToJava(long gVariant){ if (OS.g_variant_is_of_type(gVariant, OS.G_VARIANT_TYPE_BOOLEAN)){ - return new Boolean(OS.g_variant_get_boolean(gVariant)); + return OS.g_variant_get_boolean(gVariant); } // see: WebKitGTK.java 'TYPE NOTES' @@ -534,11 +534,11 @@ class WebkitGDBus { } if (OS.g_variant_is_of_type(gVariant, OS.G_VARIANT_TYPE_DOUBLE)){ - return new Double(OS.g_variant_get_double(gVariant)); + return OS.g_variant_get_double(gVariant); } if (OS.g_variant_is_of_type(gVariant, OS.G_VARIANT_TYPE_UINT64)){ - return new Long(OS.g_variant_get_uint64(gVariant)); + return OS.g_variant_get_uint64(gVariant); } if (OS.g_variant_is_of_type(gVariant, OS.G_VARIANT_TYPE_STRING)){ diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java index c713613a2c..e7799807bc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java @@ -215,7 +215,7 @@ void openDownloadWindow (final IWebDownload download, String name) { } long current = size / 1024L; long total = totalSize / 1024L; - String message = Compatibility.getMessage ("SWT_Download_Status", new Object[] {Long.valueOf(current), new Long(total)}); //$NON-NLS-1$ + String message = Compatibility.getMessage ("SWT_Download_Status", new Object[] {current, total}); //$NON-NLS-1$ statusLabel.setText (message); display.timerExec (INTERVAL, this); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java index c446e40dec..4220949516 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java @@ -392,12 +392,11 @@ long /*int*/ callJava (long /*int*/ ctx, long /*int*/ func, long /*int*/ thisObj int index = ((Double)convertToJava (ctx, result[0])).intValue (); result[0] = 0; if (index > 0) { - Object key = new Integer (index); C.memmove (result, arguments + C.PTR_SIZEOF, C.PTR_SIZEOF); type = WebKit_win32.JSValueGetType (ctx, result[0]); if (type == WebKit_win32.kJSTypeString) { String token = (String)convertToJava (ctx, result[0]); - BrowserFunction function = (BrowserFunction)functions.get (key); + BrowserFunction function = (BrowserFunction)functions.get (index); if (function != null && token.equals (function.token)) { try { C.memmove (result, arguments + 2 * C.PTR_SIZEOF, C.PTR_SIZEOF); @@ -437,11 +436,11 @@ Object convertToJava (long /*int*/ ctx, long /*int*/ value) { switch (type) { case WebKit_win32.kJSTypeBoolean: { int result = (int)WebKit_win32.JSValueToNumber (ctx, value, null); - return new Boolean (result != 0); + return result != 0; } case WebKit_win32.kJSTypeNumber: { double result = WebKit_win32.JSValueToNumber (ctx, value, null); - return new Double (result); + return result; } case WebKit_win32.kJSTypeString: { long /*int*/ string = WebKit_win32.JSValueToStringCopy (ctx, value, null); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java index 1375180d19..c4338b13ca 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java @@ -4661,7 +4661,7 @@ public void setData (String key, Object value) { if (key.equals(RUN_AWT_INVOKE_LATER_KEY)) { if (value != null) { - value = new Boolean (runAWTInvokeLater()); + value = runAWTInvokeLater(); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java index 280f4b1ebf..5ac365a557 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java @@ -585,9 +585,9 @@ public Object getData (String key) { checkWidget(); if (key == null) error (SWT.ERROR_NULL_ARGUMENT); if (key.equals (KEY_CHECK_SUBWINDOW)) { - return new Boolean ((state & CHECK_SUBWINDOW) != 0); + return (state & CHECK_SUBWINDOW) != 0; } - if (key.equals(IS_ACTIVE)) return Boolean.valueOf(isActive ()); + if (key.equals(IS_ACTIVE)) return isActive (); if ((state & KEYED_DATA) != 0) { Object [] table = (Object []) data; for (int i=1; i<table.length; i+=2) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java index 2e927d93c4..512d58815e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java @@ -1682,16 +1682,16 @@ public Object getData (String key) { checkDevice (); if (key == null) error (SWT.ERROR_NULL_ARGUMENT); if (key.equals (RUN_MESSAGES_IN_IDLE_KEY)) { - return new Boolean (runMessagesInIdle); + return runMessagesInIdle; } if (key.equals (RUN_MESSAGES_IN_MESSAGE_PROC_KEY)) { - return new Boolean (runMessagesInMessageProc); + return runMessagesInMessageProc; } if (key.equals (USE_OWNDC_KEY)) { - return new Boolean (useOwnDC); + return useOwnDC; } if (key.equals (ACCEL_KEY_HIT)) { - return new Boolean (accelKeyHit); + return accelKeyHit; } if (keys == null) return null; for (int i=0; i<keys.length; i++) { |