RFR JDK-8042887: Remove serialver -show, this tool does not need a GUI
Hi everyone, could you please review my change for JDK-8042887? http://cr.openjdk.java.net/~alanb/8042887/webrev/ I also created following issues for appropriate docs/localization updates: https://bugs.openjdk.java.net/browse/JDK-8043613 https://bugs.openjdk.java.net/browse/JDK-8043620 Thanks -Pavel
On 22/05/2014 09:47, Pavel Rappo wrote:
Hi everyone,
could you please review my change for JDK-8042887?
http://cr.openjdk.java.net/~alanb/8042887/webrev Thanks Pavel, good to see this legacy option going away. The change looks good to me and I'm happy to sponsor it for you.
-Alan.
This looks good to me. Trivially, I think you could remove the 3 and 4 arg Res.getText methods, as I don’t see them being used. -Chris. On 22 May 2014, at 09:47, Pavel Rappo <pavel.rappo@oracle.com> wrote:
Hi everyone,
could you please review my change for JDK-8042887?
http://cr.openjdk.java.net/~alanb/8042887/webrev/
I also created following issues for appropriate docs/localization updates:
https://bugs.openjdk.java.net/browse/JDK-8043613 https://bugs.openjdk.java.net/browse/JDK-8043620
Thanks -Pavel
Yeah, I've done that before. But finally decided to exclude this change and several more unrelated to the issue. I believe from the 'hg' history perspective it will look cleaner. I can file a separate bug for a tiny refactoring of this tool if you want, but being realistic I don't think anybody needs it. Here they are: @@ -169,11 +66,11 @@ */ static String serialSyntax(String classname) throws ClassNotFoundException { String ret = null; boolean classFound = false; - // If using old style of qualifyling inner classes with '$'s. + // If using old style of qualifying inner classes with '$'s. if (classname.indexOf('$') != -1) { ret = resolveClass(classname); } else { /* Try to resolve the fully qualified name and if that fails, start * replacing the '.'s with '$'s starting from the last '.', until @@ -276,25 +165,23 @@ } catch (IOException ioe) { System.err.println(Res.getText("error.parsing.classpath", envcp)); System.exit(3); } - if (!show) { /* - * Check if there are any class names specified, if it is not a - * invocation with the -show option. + * Check if there are any class names specified */ if (i == args.length) { usage(); System.exit(1); } /* * The rest of the parameters are classnames. */ boolean exitFlag = false; - for (i = i; i < args.length; i++ ) { + for (; i < args.length; i++) { try { String syntax = serialSyntax(args[i]); if (syntax != null) System.out.println(args[i] + ":" + syntax); else { @@ -184,17 +81,17 @@ classFound = true; } catch (ClassNotFoundException e) { /* Class not found so far */ } if (!classFound) { - StringBuffer workBuffer = new StringBuffer(classname); - String workName = workBuffer.toString(); + StringBuilder workBuilder = new StringBuilder(classname); + String workName = workBuilder.toString(); int i; while ((i = workName.lastIndexOf('.')) != -1 && !classFound) { - workBuffer.setCharAt(i, '$'); + workBuilder.setCharAt(i, '$'); try { - workName = workBuffer.toString(); + workName = workBuilder.toString(); ret = resolveClass(workName); classFound = true; } catch (ClassNotFoundException e) { /* Continue searching */ } @@ -423,49 +237,26 @@ * get and format message string from resource * * @param key selects message from resource */ static String getText(String key) { - return getText(key, (String)null); + return getText(key, null); } /** * get and format message string from resource * * @param key selects message from resource * @param a1 first argument */ static String getText(String key, String a1) { - return getText(key, a1, null); - } - - /** - * get and format message string from resource - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - */ - static String getText(String key, String a1, String a2) { - return getText(key, a1, a2, null); - } - - /** - * get and format message string from resource - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - * @param a3 third argument - */ - static String getText(String key, String a1, String a2, String a3) { if (messageRB == null) { initResource(); } try { String message = messageRB.getString(key); - return MessageFormat.format(message, a1, a2, a3); + return MessageFormat.format(message, a1); } catch (MissingResourceException e) { throw new Error("Fatal: Resource for serialver is broken. There is no " + key + " key in resource."); } } } -Pavel On 22 May 2014, at 14:32, Chris Hegarty <chris.hegarty@oracle.com> wrote:
This looks good to me.
Trivially, I think you could remove the 3 and 4 arg Res.getText methods, as I don’t see them being used.
-Chris.
On 22 May 2014, at 09:47, Pavel Rappo <pavel.rappo@oracle.com> wrote:
Hi everyone,
could you please review my change for JDK-8042887?
http://cr.openjdk.java.net/~alanb/8042887/webrev/
I also created following issues for appropriate docs/localization updates:
https://bugs.openjdk.java.net/browse/JDK-8043613 https://bugs.openjdk.java.net/browse/JDK-8043620
Thanks -Pavel
It is up to you. Consider it reviewed, from my perspective, either way. -Chris. On 22 May 2014, at 14:47, Pavel Rappo <pavel.rappo@oracle.com> wrote:
Yeah, I've done that before. But finally decided to exclude this change and several more unrelated to the issue. I believe from the 'hg' history perspective it will look cleaner. I can file a separate bug for a tiny refactoring of this tool if you want, but being realistic I don't think anybody needs it. Here they are:
@@ -169,11 +66,11 @@
*/ static String serialSyntax(String classname) throws ClassNotFoundException { String ret = null; boolean classFound = false;
- // If using old style of qualifyling inner classes with '$'s. + // If using old style of qualifying inner classes with '$'s.
if (classname.indexOf('$') != -1) { ret = resolveClass(classname); } else { /* Try to resolve the fully qualified name and if that fails, start * replacing the '.'s with '$'s starting from the last '.', until
@@ -276,25 +165,23 @@
} catch (IOException ioe) { System.err.println(Res.getText("error.parsing.classpath", envcp)); System.exit(3); }
- if (!show) {
/*
- * Check if there are any class names specified, if it is not a - * invocation with the -show option. + * Check if there are any class names specified
*/ if (i == args.length) { usage(); System.exit(1); }
/* * The rest of the parameters are classnames. */ boolean exitFlag = false;
- for (i = i; i < args.length; i++ ) { + for (; i < args.length; i++) {
try { String syntax = serialSyntax(args[i]); if (syntax != null) System.out.println(args[i] + ":" + syntax); else {
@@ -184,17 +81,17 @@
classFound = true; } catch (ClassNotFoundException e) { /* Class not found so far */ } if (!classFound) {
- StringBuffer workBuffer = new StringBuffer(classname); - String workName = workBuffer.toString(); + StringBuilder workBuilder = new StringBuilder(classname); + String workName = workBuilder.toString();
int i; while ((i = workName.lastIndexOf('.')) != -1 && !classFound) {
- workBuffer.setCharAt(i, '$'); + workBuilder.setCharAt(i, '$');
try {
- workName = workBuffer.toString(); + workName = workBuilder.toString();
ret = resolveClass(workName); classFound = true; } catch (ClassNotFoundException e) { /* Continue searching */ } @@ -423,49 +237,26 @@
* get and format message string from resource * * @param key selects message from resource */ static String getText(String key) {
- return getText(key, (String)null); + return getText(key, null);
}
/** * get and format message string from resource * * @param key selects message from resource * @param a1 first argument */ static String getText(String key, String a1) {
- return getText(key, a1, null); - } - - /** - * get and format message string from resource - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - */ - static String getText(String key, String a1, String a2) { - return getText(key, a1, a2, null); - } - - /** - * get and format message string from resource - * - * @param key selects message from resource - * @param a1 first argument - * @param a2 second argument - * @param a3 third argument - */ - static String getText(String key, String a1, String a2, String a3) {
if (messageRB == null) { initResource(); } try { String message = messageRB.getString(key);
- return MessageFormat.format(message, a1, a2, a3); + return MessageFormat.format(message, a1);
} catch (MissingResourceException e) { throw new Error("Fatal: Resource for serialver is broken. There is no " + key + " key in resource."); } } }
-Pavel
On 22 May 2014, at 14:32, Chris Hegarty <chris.hegarty@oracle.com> wrote:
This looks good to me.
Trivially, I think you could remove the 3 and 4 arg Res.getText methods, as I don’t see them being used.
-Chris.
On 22 May 2014, at 09:47, Pavel Rappo <pavel.rappo@oracle.com> wrote:
Hi everyone,
could you please review my change for JDK-8042887?
http://cr.openjdk.java.net/~alanb/8042887/webrev/
I also created following issues for appropriate docs/localization updates:
https://bugs.openjdk.java.net/browse/JDK-8043613 https://bugs.openjdk.java.net/browse/JDK-8043620
Thanks -Pavel
participants (3)
-
Alan Bateman
-
Chris Hegarty
-
Pavel Rappo