From 610805dfe5c696689f19c2938b230d3c1b9f1dde Mon Sep 17 00:00:00 2001 From: lkuskov Date: Thu, 5 Sep 2019 15:41:41 -0700 Subject: [PATCH] CODETOOLS-7902516 Asmtools jdis wrongly processes arguments if the command line contains -v --- src/org/openjdk/asmtools/jdis/Main.java | 12 +++++------- src/org/openjdk/asmtools/jdis/Options.java | 8 ++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/org/openjdk/asmtools/jdis/Main.java b/src/org/openjdk/asmtools/jdis/Main.java index c9922bc..2462dc2 100644 --- a/src/org/openjdk/asmtools/jdis/Main.java +++ b/src/org/openjdk/asmtools/jdis/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,18 +36,16 @@ import java.util.ArrayList; public class Main { private Options options = Options.OptionObject(); + /** * Name of the program. */ public static String programName; + /** * The stream where error message are printed. */ PrintWriter out; - /* debugging value, output stream will only allow this many - * bytes to be written before throwing an error. - */ - private int bytelimit = 0; public static final I18NResourceBundle i18n = I18NResourceBundle.getBundleForClass(Main.class); @@ -90,10 +88,10 @@ public class Main { String arg = argv[i]; switch (arg) { case "-g": - options.set(Options.PR.DEBUG); + options.setCodeOptions(); break; case "-v": - options.setCodeOptions(); + options.set(Options.PR.DEBUG); break; case "-sl": options.set(Options.PR.SRC); diff --git a/src/org/openjdk/asmtools/jdis/Options.java b/src/org/openjdk/asmtools/jdis/Options.java index 7671691..6f14059 100644 --- a/src/org/openjdk/asmtools/jdis/Options.java +++ b/src/org/openjdk/asmtools/jdis/Options.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ package org.openjdk.asmtools.jdis; import java.util.EnumSet; /** - * + * The singleton class to share global options among jdis classes. */ public class Options { @@ -39,7 +39,7 @@ public class Options { LNT, // print Line Number table PC, // print Program Counter - for all instr LABS, // print Labels (as identifiers) - CPX, // print CP indeX along with arguments + CPX, // print CP index along with arguments SRC, // print Source Line as comment HEX, // print numbers as hexadecimals VAR, // print local variables declarations @@ -73,7 +73,7 @@ public class Options { } public void setCodeOptions() { - printOptions = CODE; + printOptions.addAll(CODE); } public boolean contains(PR val) {