You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As reported by @petermr on the picocli mailing list, when a subcommand subclasses its parent command, a StackOverflowError is thrown during initialization.
java.lang.StackOverflowError
at java.util.regex.Pattern.atom(Pattern.java:2200)
at java.util.regex.Pattern.sequence(Pattern.java:2081)
at java.util.regex.Pattern.expr(Pattern.java:1998)
at java.util.regex.Pattern.group0(Pattern.java:2907)
at java.util.regex.Pattern.sequence(Pattern.java:2053)
at java.util.regex.Pattern.expr(Pattern.java:1998)
at java.util.regex.Pattern.group0(Pattern.java:2907)
at java.util.regex.Pattern.sequence(Pattern.java:2053)
at java.util.regex.Pattern.expr(Pattern.java:1998)
at java.util.regex.Pattern.compile(Pattern.java:1698)
at java.util.regex.Pattern.<init>(Pattern.java:1351)
at java.util.regex.Pattern.compile(Pattern.java:1028)
at picocli.CommandLine$RegexTransformer$Builder.addPattern(CommandLine.java:4628)
at picocli.CommandLine$RegexTransformer.createDefault(CommandLine.java:4555)
at picocli.CommandLine$Model$CommandSpec.<init>(CommandLine.java:5082)
at picocli.CommandLine$Model$CommandSpec.wrapWithoutInspection(CommandLine.java:5101)
at picocli.CommandLine$Model$CommandReflection.extractCommandSpec(CommandLine.java:9527)
at picocli.CommandLine$Model$CommandSpec.forAnnotatedObject(CommandLine.java:5116)
at picocli.CommandLine.<init>(CommandLine.java:223)
at picocli.CommandLine.toCommandLine(CommandLine.java:3212)
at picocli.CommandLine.access$12900(CommandLine.java:145)
at picocli.CommandLine$Model$CommandReflection.initSubcommands(CommandLine.java:9603)
at picocli.CommandLine$Model$CommandReflection.extractCommandSpec(CommandLine.java:9539)
at picocli.CommandLine$Model$CommandSpec.forAnnotatedObject(CommandLine.java:5116)
at picocli.CommandLine.<init>(CommandLine.java:223)
at picocli.CommandLine.toCommandLine(CommandLine.java:3212)
at picocli.CommandLine.access$12900(CommandLine.java:145)
at picocli.CommandLine$Model$CommandReflection.initSubcommands(CommandLine.java:9603)
at picocli.CommandLine$Model$CommandReflection.extractCommandSpec(CommandLine.java:9539)
...
at picocli.CommandLine.toCommandLine(CommandLine.java:3212)
at picocli.CommandLine.access$12900(CommandLine.java:145)
at picocli.CommandLine$Model$CommandReflection.initSubcommands(CommandLine.java:9603)
at picocli.CommandLine$Model$CommandReflection.extractCommandSpec(CommandLine.java:9539)
at picocli.CommandLine$Model$CommandSpec.forAnnotatedObject(CommandLine.java:5116)
at picocli.CommandLine.<init>(CommandLine.java:223)
The text was updated successfully, but these errors were encountered:
I believe this is simply a consequence of how reuse works in picocli:
When a command B subclasses another command A, it will get all attributes (and subcommands) of A.
If one of these subcommands is actually command B, then B becomes a subcommand of itself. This is not supported.
I improved things by throwing a more friendly InitializationException when such an eternal loop is detected.
As reported by @petermr on the picocli mailing list, when a subcommand subclasses its parent command, a
StackOverflowError
is thrown during initialization.To reproduce:
Example stack trace (differs per invocation):
The text was updated successfully, but these errors were encountered: