Skip to content

Commit

Permalink
Revert "[remkop#1319] Bugfix: Avoid `DuplicateOptionAnnotationsExcept…
Browse files Browse the repository at this point in the history
…ion` when parent has inherited mixed-in help options and the built-in `HelpCommand` subcommand."

This reverts commit 1a95bf2.
  • Loading branch information
MarkoMackic committed Oct 17, 2021
1 parent 5d1a17b commit 2c39d79
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 47 deletions.
1 change: 0 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Picocli follows [semantic versioning](http://semver.org/).
* [#1303] Bugfix: Prevent `IllegalArgumentException: argument type mismatch` error in method subcommands with inherited mixed-in standard help options. Thanks to [Andreas Deininger](https://github.com/deining) for raising this.
* [#1300] Bugfix: Avoid spurious warning "Could not set initial value for field boolean" when reusing `CommandLine` with ArgGroup. Thanks to [Yashodhan Ghadge](https://github.com/codexetreme) for raising this.
* [#1316] Bugfix: Avoid `DuplicateOptionAnnotationsException` thrown on `mixinStandardHelpOptions` for subcommands when parent has `scope = INHERIT` by `picocli-codegen` annotation processor. Thanks to [Philippe Charles](https://github.com/charphi) for raising this.
* [#1319] Bugfix: Avoid `DuplicateOptionAnnotationsException` when parent has inherited mixed-in help options and the built-in `HelpCommand` subcommand. Thanks to [Andreas Deininger](https://github.com/deining) for raising this.
* [#1320][#1321] Bugfix/Enhancement: Use system properties `sun.stdout.encoding` and `sun.stderr.encoding` when creating the `PrintWriters` returned by `CommandLine::getOut` and `CommandLine::getErr`. Thanks to [Philippe Charles](https://github.com/charphi) for the investigation and the pull request.
* [#1296] DOC: add Kotlin code samples to user manual; other user manual improvements. Thanks to [Andreas Deininger](https://github.com/deining) for the pull request.
* [#1299] DOC: Link to `IParameterPreprocessor` from `IParameterConsumer` javadoc. Thanks to [Andreas Deininger](https://github.com/deining) for the pull request.
Expand Down

This file was deleted.

This file was deleted.

8 changes: 2 additions & 6 deletions src/main/java/picocli/CommandLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -7156,12 +7156,8 @@ public CommandSpec negatableOptionTransformer(INegatableOptionTransformer newVal
* @see Command#mixinStandardHelpOptions() */
public CommandSpec mixinStandardHelpOptions(boolean newValue) {
if (newValue) {
CommandSpec mixin = CommandSpec.forAnnotatedObject(new AutoHelpMixin(), new DefaultFactory());
boolean overlap = false;
for (String key : mixin.optionsMap().keySet()) {
if (optionsMap().containsKey(key)) { overlap = true; break; }
}
if (!overlap) { // #1316, 1319 avoid DuplicateOptionAnnotationsException
if (!mixins.containsKey(AutoHelpMixin.KEY)) { // #1316 avoid DuplicateOptionAnnotationsException
CommandSpec mixin = CommandSpec.forAnnotatedObject(new AutoHelpMixin(), new DefaultFactory());
mixin.inherited = this.inherited();
addMixin(AutoHelpMixin.KEY, mixin);
}
Expand Down
1 change: 1 addition & 0 deletions src/test/java/picocli/InheritedOptionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ class Example { }
new CommandLine(new Example()); // succeeds without error
}

@Ignore("Needs fix for #1319")
@Test
public void testIssue1319() {
@Command(scope = CommandLine.ScopeType.INHERIT
Expand Down

0 comments on commit 2c39d79

Please sign in to comment.