Summary
@GroupCommandDefinition is now redundant. All its attributes are available on @CommandDefinition, which gained groupCommands() in a previous release. The two annotations are functionally identical — the only difference is that @GroupCommandDefinition lacks disableParsing() (which is ignored for group commands anyway).
Current state
| Attribute |
@CommandDefinition |
@GroupCommandDefinition |
name |
✅ |
✅ |
description |
✅ |
✅ |
aliases |
✅ |
✅ |
generateHelp |
✅ |
✅ |
version |
✅ |
✅ |
validator |
✅ |
✅ |
resultHandler |
✅ |
✅ |
activator |
✅ |
✅ |
defaultValueProvider |
✅ |
✅ |
stopAtFirstPositional |
✅ |
✅ |
sortOptions |
✅ |
✅ |
helpUrl |
✅ |
✅ |
helpGroup |
✅ |
✅ |
helpSectionProvider |
✅ |
✅ |
groupCommands |
✅ |
✅ |
disableParsing |
✅ |
❌ (N/A for groups) |
Migration path
Replace:
@GroupCommandDefinition(name = "git", description = "Git",
groupCommands = {CommitCmd.class, PushCmd.class})
With:
@CommandDefinition(name = "git", description = "Git",
groupCommands = {CommitCmd.class, PushCmd.class})
Proposed plan
Phase 1: Deprecate (this release)
- Add
@Deprecated to @GroupCommandDefinition
- Add deprecation note to javadoc pointing to
@CommandDefinition(groupCommands)
- Update project site documentation to use
@CommandDefinition for all group command examples
- Update all internal tests and examples to use
@CommandDefinition(groupCommands)
Phase 2: Remove (future release)
- Remove
@GroupCommandDefinition annotation
- Remove the
GroupCommandDefinition handling branch in AeshCommandContainerBuilder.doGenerateCommandLineParser()
- Remove the
GroupCommandDefinition handling in CodeGenerator (processor)
- Remove from
AeshCommandContainerBuilder.getCommandAliases() and getCommandName() fallbacks
What needs to change in aesh
aesh module:
AeshCommandContainerBuilder.doGenerateCommandLineParser() — has separate branch for @GroupCommandDefinition (lines ~189-247). The @CommandDefinition branch already handles groupCommands.length > 0. The @GroupCommandDefinition branch can be removed once deprecated.
AeshCommandContainerBuilder.getCommandAliases() / getCommandName() — fallback checks for @GroupCommandDefinition. Can be removed.
aesh-processor module:
CodeGenerator — handles @GroupCommandDefinition separately from @CommandDefinition. Both paths generate equivalent code. Can be unified.
AeshAnnotationProcessor — scans for both annotation types. Can be simplified.
Impact
- jbang: Uses
@CommandDefinition(groupCommands) already (migrated in the aesh migration). No impact.
- Existing aesh users: Any code using
@GroupCommandDefinition needs to switch to @CommandDefinition(groupCommands). This is a mechanical replacement — same attributes, same behavior.
- Tests: ~15 test classes use
@GroupCommandDefinition. These should be migrated in Phase 1 to validate the @CommandDefinition path.
Context
@GroupCommandDefinition was the original way to define group commands. When groupCommands() was added to @CommandDefinition, both annotations became functionally identical. Having two ways to do the same thing adds confusion and maintenance burden (two code paths in the builder, two paths in the processor, documentation must explain both).
Summary
@GroupCommandDefinitionis now redundant. All its attributes are available on@CommandDefinition, which gainedgroupCommands()in a previous release. The two annotations are functionally identical — the only difference is that@GroupCommandDefinitionlacksdisableParsing()(which is ignored for group commands anyway).Current state
@CommandDefinition@GroupCommandDefinitionnamedescriptionaliasesgenerateHelpversionvalidatorresultHandleractivatordefaultValueProviderstopAtFirstPositionalsortOptionshelpUrlhelpGrouphelpSectionProvidergroupCommandsdisableParsingMigration path
Replace:
With:
Proposed plan
Phase 1: Deprecate (this release)
@Deprecatedto@GroupCommandDefinition@CommandDefinition(groupCommands)@CommandDefinitionfor all group command examples@CommandDefinition(groupCommands)Phase 2: Remove (future release)
@GroupCommandDefinitionannotationGroupCommandDefinitionhandling branch inAeshCommandContainerBuilder.doGenerateCommandLineParser()GroupCommandDefinitionhandling inCodeGenerator(processor)AeshCommandContainerBuilder.getCommandAliases()andgetCommandName()fallbacksWhat needs to change in aesh
aesh module:
AeshCommandContainerBuilder.doGenerateCommandLineParser()— has separate branch for@GroupCommandDefinition(lines ~189-247). The@CommandDefinitionbranch already handlesgroupCommands.length > 0. The@GroupCommandDefinitionbranch can be removed once deprecated.AeshCommandContainerBuilder.getCommandAliases()/getCommandName()— fallback checks for@GroupCommandDefinition. Can be removed.aesh-processor module:
CodeGenerator— handles@GroupCommandDefinitionseparately from@CommandDefinition. Both paths generate equivalent code. Can be unified.AeshAnnotationProcessor— scans for both annotation types. Can be simplified.Impact
@CommandDefinition(groupCommands)already (migrated in the aesh migration). No impact.@GroupCommandDefinitionneeds to switch to@CommandDefinition(groupCommands). This is a mechanical replacement — same attributes, same behavior.@GroupCommandDefinition. These should be migrated in Phase 1 to validate the@CommandDefinitionpath.Context
@GroupCommandDefinitionwas the original way to define group commands. WhengroupCommands()was added to@CommandDefinition, both annotations became functionally identical. Having two ways to do the same thing adds confusion and maintenance burden (two code paths in the builder, two paths in the processor, documentation must explain both).