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/org.eclipse.swt/Eclipse SWT WebKit | |
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/org.eclipse.swt/Eclipse SWT WebKit')
5 files changed, 13 insertions, 15 deletions
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); |