diff --git a/docs/A-Whirlwind-Tour-of-Picocli.html b/docs/A-Whirlwind-Tour-of-Picocli.html index 16b9e1a21..6c2bca36a 100644 --- a/docs/A-Whirlwind-Tour-of-Picocli.html +++ b/docs/A-Whirlwind-Tour-of-Picocli.html @@ -1566,81 +1566,81 @@ }); }); - - - + + + diff --git a/docs/announcing-picocli-1.0.html b/docs/announcing-picocli-1.0.html index deafeddc3..6330fea13 100644 --- a/docs/announcing-picocli-1.0.html +++ b/docs/announcing-picocli-1.0.html @@ -528,81 +528,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/docs/autocomplete.html b/docs/autocomplete.html index 0d74cc81c..933cabbc1 100644 --- a/docs/autocomplete.html +++ b/docs/autocomplete.html @@ -1565,81 +1565,81 @@ }); }); - - - + + + diff --git a/docs/build-great-native-cli-apps-in-java-with-graalvm-and-picocli.html b/docs/build-great-native-cli-apps-in-java-with-graalvm-and-picocli.html index 37d153ce8..8922a8911 100644 --- a/docs/build-great-native-cli-apps-in-java-with-graalvm-and-picocli.html +++ b/docs/build-great-native-cli-apps-in-java-with-graalvm-and-picocli.html @@ -527,81 +527,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/docs/feedback.html b/docs/feedback.html index fce394745..8d651b5b7 100644 --- a/docs/feedback.html +++ b/docs/feedback.html @@ -437,81 +437,81 @@ #footer-text{color:rgba(0,0,0,.6);font-size:.9em}} @media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}} - - - + + + diff --git a/docs/groovy-2.5-clibuilder-renewal-part1.html b/docs/groovy-2.5-clibuilder-renewal-part1.html index 742b374b3..61b584c60 100644 --- a/docs/groovy-2.5-clibuilder-renewal-part1.html +++ b/docs/groovy-2.5-clibuilder-renewal-part1.html @@ -527,81 +527,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/docs/groovy-2.5-clibuilder-renewal-part2.html b/docs/groovy-2.5-clibuilder-renewal-part2.html index e0dc1395e..b33e9cb9e 100644 --- a/docs/groovy-2.5-clibuilder-renewal-part2.html +++ b/docs/groovy-2.5-clibuilder-renewal-part2.html @@ -527,81 +527,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/docs/groovy-2.5-clibuilder-renewal.html b/docs/groovy-2.5-clibuilder-renewal.html index 9f54fb583..44a9fdf9a 100644 --- a/docs/groovy-2.5-clibuilder-renewal.html +++ b/docs/groovy-2.5-clibuilder-renewal.html @@ -527,81 +527,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/docs/index.html b/docs/index.html index aa9081361..2de2bfce3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1711,81 +1711,81 @@ }); }); - - - + + + diff --git a/docs/man/index.html b/docs/man/index.html index c0dc21e29..6d50a3a71 100644 --- a/docs/man/index.html +++ b/docs/man/index.html @@ -437,81 +437,81 @@ #footer-text{color:rgba(0,0,0,.6);font-size:.9em}} @media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}} - - - + + + diff --git a/docs/migrating-from-commons-cli.html b/docs/migrating-from-commons-cli.html index 3def3c5de..1a4b29c58 100644 --- a/docs/migrating-from-commons-cli.html +++ b/docs/migrating-from-commons-cli.html @@ -528,81 +528,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/docs/picocli-2.0-do-more-with-less.html b/docs/picocli-2.0-do-more-with-less.html index 3d4fa11e7..007cc40f8 100644 --- a/docs/picocli-2.0-do-more-with-less.html +++ b/docs/picocli-2.0-do-more-with-less.html @@ -527,81 +527,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/docs/picocli-2.0-groovy-scripts-on-steroids.html b/docs/picocli-2.0-groovy-scripts-on-steroids.html index 08010b5ab..6ed41b031 100644 --- a/docs/picocli-2.0-groovy-scripts-on-steroids.html +++ b/docs/picocli-2.0-groovy-scripts-on-steroids.html @@ -527,81 +527,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/docs/picocli-on-graalvm.html b/docs/picocli-on-graalvm.html index 6c8e2266f..0b4053eaf 100644 --- a/docs/picocli-on-graalvm.html +++ b/docs/picocli-on-graalvm.html @@ -438,81 +438,81 @@ @media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}} - - - + + + diff --git a/docs/picocli-programmatic-api.html b/docs/picocli-programmatic-api.html index 6f7c1af6f..28d707501 100644 --- a/docs/picocli-programmatic-api.html +++ b/docs/picocli-programmatic-api.html @@ -438,81 +438,81 @@ @media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}} - - - + + + diff --git a/docs/quick-guide.html b/docs/quick-guide.html index 255508741..3ae7a11a0 100644 --- a/docs/quick-guide.html +++ b/docs/quick-guide.html @@ -1711,81 +1711,81 @@ }); }); - - - + + + diff --git a/docs/zh/picocli-2.0-do-more-with-less.html b/docs/zh/picocli-2.0-do-more-with-less.html index 7874f9e92..bf9260d1c 100644 --- a/docs/zh/picocli-2.0-do-more-with-less.html +++ b/docs/zh/picocli-2.0-do-more-with-less.html @@ -527,81 +527,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/docs/zh/picocli-2.0-groovy-scripts-on-steroids.html b/docs/zh/picocli-2.0-groovy-scripts-on-steroids.html index d7f3f18fe..0a17b6af2 100644 --- a/docs/zh/picocli-2.0-groovy-scripts-on-steroids.html +++ b/docs/zh/picocli-2.0-groovy-scripts-on-steroids.html @@ -527,81 +527,81 @@ .CodeRay .change .change{color:#66f} .CodeRay .head .head{color:#f4f} - - - + + + diff --git a/picocli-annotation-processing-tests/src/test/java/picocli/Issue1380Test.java b/picocli-annotation-processing-tests/src/test/java/picocli/Issue1380Test.java index c430c38d3..ecb0ed2e1 100644 --- a/picocli-annotation-processing-tests/src/test/java/picocli/Issue1380Test.java +++ b/picocli-annotation-processing-tests/src/test/java/picocli/Issue1380Test.java @@ -10,6 +10,20 @@ import static org.junit.Assert.assertEquals; +/** + * Testing class for exclusiveOptions + */ +class Issue1380ExclusiveOptions { + @Option(names = {"-s", "--silent"}, description = "Silent mode", required = false) + protected boolean silent; + + @Option(names = {"-v", "--verbose"}, description = "Verbose mode", required = false) + protected boolean verbose; + + @Option(names = {"-j", "--json"}, description = "JSON printing", required = false) + protected boolean json; +} + /** * Testing class for creating a commandline with ArgGroup exclusive tree */ @@ -17,47 +31,7 @@ class TestingClassExclusiveTrue { @ArgGroup(exclusive = true, multiplicity = "0..1") - private TestingClassExclusiveTrue.ExclusiveOptions exclusive; - - /** - * Added getters to satisfy PMF and findBug requirements - */ - public ExclusiveOptions getExclusive() { - return this.exclusive; - } - - private static class ExclusiveOptions { - @Option(names = {"-s", "--silent"}, description = "Silent mode", required = false) - private boolean silent; - - /** - * Added getters to satisfy PMF and findBug requirements - */ - public boolean getSilent() { - return this.silent; - } - - @Option(names = {"-v", "--verbose"}, description = "Verbose mode", required = false) - private boolean verbose; - - /** - * Added getters to satisfy PMF and findBug requirements - */ - public boolean getVerbose() { - return this.verbose; - } - - @Option(names = {"-j", "--json"}, description = "JSON printing", required = false) - private boolean json; - - /** - * Added getters to satisfy PMF and findBug requirements - */ - public boolean getJson(){ - return this.json; - } - - } + protected Issue1380ExclusiveOptions exclusive; } /** @@ -67,55 +41,16 @@ public boolean getJson(){ class TestingClassExclusiveFalse { @ArgGroup(exclusive = false, multiplicity = "0..1") - private TestingClassExclusiveFalse.ExclusiveOptions exclusive; - - /** - * Added getters to satisfy PMF and findBug requirements - */ - public ExclusiveOptions getExclusive() { - return this.exclusive; - } - - private static class ExclusiveOptions { - @Option(names = {"-s", "--silent"}, description = "Silent mode", required = false) - private boolean silent; - - /** - * Added getters to satisfy PMF and findBug requirements - */ - public boolean getSilent() { - return this.silent; - } - - @Option(names = {"-v", "--verbose"}, description = "Verbose mode", required = false) - private boolean verbose; - - /** - * Added getters to satisfy PMF and findBug requirements - */ - public boolean getVerbose() { - return this.verbose; - } - - @Option(names = {"-j", "--json"}, description = "JSON printing", required = false) - private boolean json; - - /** - * Added getters to satisfy PMF and findBug requirements - */ - public boolean getJson(){ - return this.json; - } - } + protected Issue1380ExclusiveOptions exclusive; } /** - * JUnit testing class for issue 1380 // CS427 https://github.com/remkop/picocli/issues/1380 + * JUnit testing class for issue#1380 // CS427 https://github.com/remkop/picocli/issues/1380 */ public class Issue1380Test { /** - * JUnit test class for issue 1380 with exclusive set to true // CS427 https://github.com/remkop/picocli/issues/1380 + * JUnit test class for issue#1380 with exclusive set to true // CS427 https://github.com/remkop/picocli/issues/1380 */ @Test public void testingWithExclusiveTrue() { @@ -131,11 +66,10 @@ public void testingWithExclusiveTrue() { " -v, --verbose Verbose mode\n"; assertEquals(expectedText, returnedText); - } /** - * JUnit test class for issue 1380 with exclusive set to false // CS427 https://github.com/remkop/picocli/issues/1380 + * JUnit test class for issue#1380 with exclusive set to false// CS427 https://github.com/remkop/picocli/issues/1380 */ @Test public void testingWithExclusiveFalse() { @@ -150,6 +84,5 @@ public void testingWithExclusiveFalse() { " -v, --verbose Verbose mode\n"; assertEquals(expectedText, returnedText); - } } diff --git a/picocli-annotation-processing-tests/src/test/java/picocli/Issue1420Test.java b/picocli-annotation-processing-tests/src/test/java/picocli/Issue1420Test.java index f44ce9de8..5498e4355 100644 --- a/picocli-annotation-processing-tests/src/test/java/picocli/Issue1420Test.java +++ b/picocli-annotation-processing-tests/src/test/java/picocli/Issue1420Test.java @@ -18,40 +18,29 @@ class TestingClass { @ArgGroup(exclusive = true, multiplicity = "0..1") - private TestingClass.ExclusiveOptions exclusive; + protected TestingClass.ExclusiveOptions exclusive; public TestingClass.ExclusiveOptions getExclusive() { return this.exclusive; } private static class ExclusiveOptions { @Option(names = {"-h", "--help"}, descriptionKey = "help.message", required = false) - private boolean showHelp; + protected boolean showHelp; @Option(names = {"-j", "--json"}, descriptionKey = "json.message", required = false) - private boolean isJson; - - /** - * Added getters to satisfy PMF and findBug requirements - */ - public boolean getshowHelp(){ return this.showHelp; } - - /** - * Added getters to satisfy PMF and findBug requirements - */ - public boolean getJson(){ return this.isJson; } + protected boolean isJson; } } - @Ignore /** - * JUnit testing class for issue 1420 // CS427 https://github.com/remkop/picocli/issues/1420 + * JUnit testing class for issue#1420 // CS427 https://github.com/remkop/picocli/issues/1420 */ public class Issue1420Test { /** - * JUnit test class for issue 1420 with resourceBundle // CS427 https://github.com/remkop/picocli/issues/1420 + * JUnit test class for issue#1420 with resourceBundle // CS427 https://github.com/remkop/picocli/issues/1420 */ @Test public void testingWithResourceBundle1() { @@ -65,6 +54,5 @@ public void testingWithResourceBundle1() { " -j, --json Set json export-on\n"; assertEquals(expectedText, returnedText); - } } diff --git a/qaplug_result.html b/qaplug_result.html deleted file mode 100644 index cecebe7eb..000000000 --- a/qaplug_result.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - -QAPlug scan results - - - -     Project:
          picocli
     Scope:
          File '…/src/main/java/picocli/CommandLine.java [picocli.main]'
     Profile:
          Default
     Results:
          Enabled coding rules: 459
          Problems found: 1005

     Time statistics: -     Detailed Results:
          picocli

- - diff --git a/src/main/java/picocli/CommandLine.java b/src/main/java/picocli/CommandLine.java index dadd7cfd9..22399cebb 100644 --- a/src/main/java/picocli/CommandLine.java +++ b/src/main/java/picocli/CommandLine.java @@ -8528,7 +8528,7 @@ public abstract static class ArgSpec { // parser fields private boolean required; - private boolean optionIsNotRequired; + private boolean originallyRequired; private final boolean interactive; private final boolean echo; private final String prompt; @@ -8581,7 +8581,7 @@ private > ArgSpec(Builder builder) { annotatedElement = builder.annotatedElement; defaultValue = NO_DEFAULT_VALUE.equals(builder.defaultValue) ? null : builder.defaultValue; required = builder.required; - optionIsNotRequired = builder.optionIsNotRequired; + originallyRequired = builder.originallyRequired; toString = builder.toString; getter = builder.getter; setter = builder.setter; @@ -8638,11 +8638,11 @@ void applyInitialValue(Tracer tracer) { } } - /** Returns whether this is a required option or positional parameter without a default value. - * If this argument is part of a {@linkplain ArgGroup group}, this method returns whether this argument is required within the group (so it is not necessarily a required argument for the command). - * @see Option#optionIsNotRequired() */ - public boolean optionIsNotRequired(){ - return optionIsNotRequired; + /** Returns the originally required option, regardless of whether the option is used in an exclusive group or not. + * @since 4.7.0 + * @see Option#required() */ + public boolean originallyRequired(){ + return originallyRequired; } /** Returns whether this is a required option or positional parameter without a default value. @@ -9196,7 +9196,7 @@ abstract static class Builder> { private String[] description; private String descriptionKey; private boolean required; - private boolean optionIsNotRequired; + private boolean originallyRequired; private boolean interactive; private boolean echo; private String prompt; @@ -9234,7 +9234,7 @@ abstract static class Builder> { description = original.description; descriptionKey = original.descriptionKey; required = original.required; - optionIsNotRequired = original.optionIsNotRequired; + originallyRequired = original.originallyRequired; interactive = original.interactive; echo = original.echo; prompt = original.prompt; @@ -10132,8 +10132,8 @@ public static class ArgGroupSpec implements IOrdered { if (!arg.required()) { modifiedArgs += sep + (arg.isOption() ? ((OptionSpec) arg).longestName() : (arg.paramLabel() + "[" + ((PositionalParamSpec) arg).index() + "]")); sep = ","; - //Keep initial required as optionIsNotRequired for Issue#1380 https://github.com/remkop/picocli/issues/1380 - arg.optionIsNotRequired = true; + //Keep initial required as originallyRequired for Issue#1380 https://github.com/remkop/picocli/issues/1380 + arg.originallyRequired = true; arg.required = true; } } @@ -16128,7 +16128,7 @@ public Text[][] render(OptionSpec option, IParamLabelRenderer paramLabelRenderer String longOption = join(names, shortOptionCount, names.length - shortOptionCount, ", "); Text longOptionText = createLongOptionText(option, paramLabelRenderer, scheme, longOption); - String requiredOption = !option.optionIsNotRequired() && option.required() ? requiredMarker : ""; + String requiredOption = !option.originallyRequired() && option.required() ? requiredMarker : ""; return renderDescriptionLines(option, scheme, requiredOption, shortOption, longOptionText); }