forked from remkop/picocli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[remkop#1319] Bugfix: Avoid
DuplicateOptionAnnotationsException
whe…
…n parent has inherited mixed-in help options and the built-in `HelpCommand` subcommand. Closes remkop#1319
- Loading branch information
1 parent
ab03e80
commit 1a95bf2
Showing
5 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ion-processing-tests/src/test/java/picocli/annotation/processing/tests/Issue1319Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package picocli.annotation.processing.tests; | ||
|
||
import com.google.testing.compile.Compilation; | ||
import com.google.testing.compile.JavaFileObjects; | ||
import org.junit.Test; | ||
|
||
import javax.annotation.processing.Processor; | ||
|
||
import static com.google.testing.compile.CompilationSubject.assertThat; | ||
import static com.google.testing.compile.Compiler.javac; | ||
|
||
public class Issue1319Test { | ||
@Test | ||
public void testIssue1319() { | ||
Processor processor = new AnnotatedCommandSourceGeneratorProcessor(); | ||
Compilation compilation = | ||
javac() | ||
.withProcessors(processor) | ||
.compile(JavaFileObjects.forResource( | ||
"picocli/issue1319/InheritHelpApp.java")); | ||
|
||
assertThat(compilation).succeeded(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
picocli-annotation-processing-tests/src/test/resources/picocli/issue1319/InheritHelpApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package picocli.issue1319; | ||
|
||
import picocli.CommandLine; | ||
|
||
@CommandLine.Command(scope = CommandLine.ScopeType.INHERIT | ||
, mixinStandardHelpOptions = true | ||
, subcommands = { CommandLine.HelpCommand.class } | ||
) | ||
class InheritHelpApp { | ||
int subFoo; | ||
|
||
@CommandLine.Command() | ||
void sub(@CommandLine.Option(names = "-foo") int foo) { | ||
subFoo = foo; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters