diff --git a/core/java/src/gnu/getopt/Getopt.java b/core/java/src/gnu/getopt/Getopt.java index caf7f49cac90a653804e4aa2a0dbb94abe08154b..8a9a44720ee491d056e229a5c4c1d7709fa61450 100644 --- a/core/java/src/gnu/getopt/Getopt.java +++ b/core/java/src/gnu/getopt/Getopt.java @@ -935,8 +935,8 @@ checkLongOption() // +option or -option else { - Object[] msgArgs = { progname, new - Character(argv[optind-1].charAt(0)).toString(), + Object[] msgArgs = { progname, + Character.toString(argv[optind-1].charAt(0)), pfound.name }; System.err.println(MessageFormat.format( _messages.getString("getopt.arguments2"), @@ -1138,8 +1138,8 @@ getopt() } else { - Object[] msgArgs = { progname, new - Character(argv[optind].charAt(0)).toString(), + Object[] msgArgs = { progname, + Character.toString(argv[optind].charAt(0)), nextchar }; System.err.println(MessageFormat.format( _messages.getString("getopt.unrecognized2"), @@ -1176,15 +1176,15 @@ getopt() if (posixly_correct) { // 1003.2 specifies the format of this message - Object[] msgArgs = { progname, new - Character((char)c).toString() }; + Object[] msgArgs = { progname, + Character.toString((char)c) }; System.err.println(MessageFormat.format( _messages.getString("getopt.illegal"), msgArgs)); } else { - Object[] msgArgs = { progname, new - Character((char)c).toString() }; + Object[] msgArgs = { progname, + Character.toString((char)c) }; System.err.println(MessageFormat.format( _messages.getString("getopt.invalid"), msgArgs)); } @@ -1208,8 +1208,8 @@ getopt() if (opterr) { // 1003.2 specifies the format of this message. - Object[] msgArgs = { progname, new - Character((char)c).toString() }; + Object[] msgArgs = { progname, + Character.toString((char)c) }; System.err.println(MessageFormat.format( _messages.getString("getopt.requires2"), msgArgs)); } @@ -1270,8 +1270,8 @@ getopt() if (opterr) { // 1003.2 specifies the format of this message - Object[] msgArgs = { progname, new - Character((char)c).toString() }; + Object[] msgArgs = { progname, + Character.toString((char)c) }; System.err.println(MessageFormat.format( _messages.getString("getopt.requires2"), msgArgs)); } @@ -1300,8 +1300,8 @@ getopt() if (opterr) { // 1003.2 specifies the format of this message - Object[] msgArgs = { progname, new - Character((char)c).toString() }; + Object[] msgArgs = { progname, + Character.toString((char)c) }; System.err.println(MessageFormat.format( _messages.getString("getopt.requires2"), msgArgs)); } diff --git a/core/java/src/gnu/getopt/LongOpt.java b/core/java/src/gnu/getopt/LongOpt.java index 9de9f43ad56d48c7f4458b60665b40e640f3d6a3..644a4b91f5159c378572662ad906803ebcfc790a 100644 --- a/core/java/src/gnu/getopt/LongOpt.java +++ b/core/java/src/gnu/getopt/LongOpt.java @@ -127,7 +127,7 @@ LongOpt(String name, int has_arg, if ((has_arg != NO_ARGUMENT) && (has_arg != REQUIRED_ARGUMENT) && (has_arg != OPTIONAL_ARGUMENT)) { - Object[] msgArgs = { new Integer(has_arg).toString() }; + Object[] msgArgs = { Integer.toString(has_arg) }; throw new IllegalArgumentException(MessageFormat.format( _messages.getString("getopt.invalidValue"), msgArgs)); } diff --git a/core/java/src/gnu/gettext/GettextResource.java b/core/java/src/gnu/gettext/GettextResource.java index d0dbc05128670e26f09f1fd683e7cb098e03e593..3733a26eeaad0299bb810f47c672b0d26e18069b 100644 --- a/core/java/src/gnu/gettext/GettextResource.java +++ b/core/java/src/gnu/gettext/GettextResource.java @@ -148,7 +148,7 @@ public abstract class GettextResource extends ResourceBundle { String[] pluralforms = (String[])localValue; long i = 0; try { - i = ((Long) pluralEvalMethod.invoke(catalog, new Object[] { new Long(n) })).longValue(); + i = ((Long) pluralEvalMethod.invoke(catalog, new Object[] { Long.valueOf(n) })).longValue(); if (!(i >= 0 && i < pluralforms.length)) i = 0; } catch (IllegalAccessException e) { diff --git a/core/java/src/net/i2p/crypto/provider/I2PProvider.java b/core/java/src/net/i2p/crypto/provider/I2PProvider.java index b6b26d396d779b8a04d9414b798934b64b8ef539..3c0e28a15dc9fdbee44eb9b36ee0a8da3974130c 100644 --- a/core/java/src/net/i2p/crypto/provider/I2PProvider.java +++ b/core/java/src/net/i2p/crypto/provider/I2PProvider.java @@ -20,6 +20,8 @@ public final class I2PProvider extends Provider { * <code>Security.addProvider()</code> mechanism. */ public I2PProvider() { + // following constructor deprecated in Java 9, + // replaced by (String,String,String) added in Java 9 super(PROVIDER_NAME, 0.1, INFO); AccessController.doPrivileged(new PrivilegedAction<Void>() { diff --git a/router/java/src/com/southernstorm/noise/protocol/Noise.java b/router/java/src/com/southernstorm/noise/protocol/Noise.java index 29764faa25e920c70fd6f27459bc08fd1f0d9218..f21184862a117663eae8814b6297dc35c0ffeb11 100644 --- a/router/java/src/com/southernstorm/noise/protocol/Noise.java +++ b/router/java/src/com/southernstorm/noise/protocol/Noise.java @@ -125,11 +125,10 @@ public final class Noise { static void throwBadTagException() throws BadPaddingException { try { + // java since 1.7; android since API 19 Class<?> c = Class.forName("javax.crypto.AEADBadTagException"); - throw (BadPaddingException)(c.newInstance()); - } catch (ClassNotFoundException e) { - } catch (InstantiationException e) { - } catch (IllegalAccessException e) { + throw (BadPaddingException)(c.getDeclaredConstructor().newInstance()); + } catch (Exception e) { } throw new BadPaddingException(); }