CODETOOLS-7902516 Asmtools jdis wrongly processes arguments if the command line contains -v

This commit is contained in:
lkuskov 2019-09-05 15:41:41 -07:00
parent 54e032ceb0
commit 610805dfe5
2 changed files with 9 additions and 11 deletions

View File

@ -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);

View File

@ -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) {