langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
changeset 40835 6ab9ed1abc46
parent 40762 f8883aa0053c
child 41252 058d83c9b1c7
equal deleted inserted replaced
40777:e384420383a5 40835:6ab9ed1abc46
   507         }
   507         }
   508     },
   508     },
   509 
   509 
   510     XDIAGS("-Xdiags:", "opt.diags", EXTENDED, BASIC, ONEOF, "compact", "verbose"),
   510     XDIAGS("-Xdiags:", "opt.diags", EXTENDED, BASIC, ONEOF, "compact", "verbose"),
   511 
   511 
   512     XDEBUG("-Xdebug:", null, HIDDEN, BASIC) {
   512     DEBUG("--debug:", null, HIDDEN, BASIC) {
   513         @Override
   513         @Override
   514         public boolean process(OptionHelper helper, String option) {
   514         public boolean process(OptionHelper helper, String option) {
   515             String p = option.substring(option.indexOf(':') + 1).trim();
   515             return HiddenGroup.DEBUG.process(helper, option);
   516             String[] subOptions = p.split(";");
   516         }
   517             for (String subOption : subOptions) {
   517     },
   518                 subOption = "debug." + subOption.trim();
   518 
   519                 XD.process(helper, subOption, subOption);
   519     SHOULDSTOP("--should-stop:", null, HIDDEN, BASIC) {
   520             }
   520         @Override
   521             return false;
   521         public boolean process(OptionHelper helper, String option) {
   522         }
   522             return HiddenGroup.SHOULDSTOP.process(helper, option);
   523     },
   523         }
   524 
   524     },
   525     XSHOULDSTOP("-Xshouldstop:", null, HIDDEN, BASIC) {
   525 
   526         @Override
   526     DIAGS("--diags:", null, HIDDEN, BASIC) {
   527         public boolean process(OptionHelper helper, String option) {
       
   528             String p = option.substring(option.indexOf(':') + 1).trim();
       
   529             String[] subOptions = p.split(";");
       
   530             for (String subOption : subOptions) {
       
   531                 subOption = "shouldstop." + subOption.trim();
       
   532                 XD.process(helper, subOption, subOption);
       
   533             }
       
   534             return false;
       
   535         }
       
   536     },
       
   537 
       
   538     DIAGS("-diags:", null, HIDDEN, BASIC) {
       
   539         @Override
   527         @Override
   540         public boolean process(OptionHelper helper, String option) {
   528         public boolean process(OptionHelper helper, String option) {
   541             return HiddenGroup.DIAGS.process(helper, option);
   529             return HiddenGroup.DIAGS.process(helper, option);
   542         }
   530         }
   543     },
   531     },
   752         /** The expected value is one of more of the set of choices. */
   740         /** The expected value is one of more of the set of choices. */
   753         ANYOF
   741         ANYOF
   754     }
   742     }
   755 
   743 
   756     enum HiddenGroup {
   744     enum HiddenGroup {
   757         DIAGS("diags");
   745         DIAGS("diags"),
       
   746         DEBUG("debug"),
       
   747         SHOULDSTOP("should-stop");
       
   748 
       
   749         static final Set<String> skipSet = new java.util.HashSet<>(
       
   750                 Arrays.asList("--diags:", "--debug:", "--should-stop:"));
   758 
   751 
   759         final String text;
   752         final String text;
   760 
   753 
   761         HiddenGroup(String text) {
   754         HiddenGroup(String text) {
   762             this.text = text;
   755             this.text = text;
   768             for (String subOption : subOptions) {
   761             for (String subOption : subOptions) {
   769                 subOption = text + "." + subOption.trim();
   762                 subOption = text + "." + subOption.trim();
   770                 XD.process(helper, subOption, subOption);
   763                 XD.process(helper, subOption, subOption);
   771             }
   764             }
   772             return false;
   765             return false;
       
   766         }
       
   767 
       
   768         static boolean skip(String name) {
       
   769             return skipSet.contains(name);
   773         }
   770         }
   774     }
   771     }
   775 
   772 
   776     /**
   773     /**
   777      * The "primary name" for this option.
   774      * The "primary name" for this option.
   928         }
   925         }
   929         return false;
   926         return false;
   930     }
   927     }
   931 
   928 
   932     private boolean matches(String option, String name) {
   929     private boolean matches(String option, String name) {
   933         if (name.startsWith("--")) {
   930         if (name.startsWith("--") && !HiddenGroup.skip(name)) {
   934             return option.equals(name)
   931             return option.equals(name)
   935                     || hasArg() && option.startsWith(name + "=");
   932                     || hasArg() && option.startsWith(name + "=");
   936         }
   933         }
   937 
   934 
   938         boolean hasSuffix = (argKind == ArgKind.ADJACENT)
   935         boolean hasSuffix = (argKind == ArgKind.ADJACENT)