-
Notifications
You must be signed in to change notification settings - Fork 446
Closed
Labels
theme: usagehelpAn issue or change related to the usage help messageAn issue or change related to the usage help messagetype: question ❔
Description
Here is my situation:
- I have an abstract class GeneralCommand and a subclass SpecificCommand.
- In the command annotation of SpecificCommand I specify a resource bundle:
@Command(name = "spccmd", resourceBundle = "MyBundle") - In GeneralCommand I have a subcommand
make, where I want to use a value from the resource bundle in the description text:@Parameters(description = ["Restrict processing to \${bundle:unitNamePlural:-units} that match this string."]) pattern: String?
The output of spccmd make -h always shows the default value 'units' and never the value in the resource bundle.
Some more facts:
- When I programmatically access the resource bundle with
CommandLine.resourceBundle.getString("unitNamePlural")it works fine. So the resource bundle is found and the key is there. (I do this in a Companion object of GeneralCommand; I write in kotlin.) - When I use an environment variable instead (
\${env:unitNamePlural:-units}) it works fine. - When I skip the whole superclass/subclass thing and implement it all in the same class, it works fine.
I realise that trying to access the subclass's resource bundle from the superclass is perhaps expecting too much, but is there another way of doing this? Can I declare an 'abstract annotation member' in the superclass that the subclass has to implement, in order to insert a value specified in the subclass in the superclass's annotation?
Metadata
Metadata
Assignees
Labels
theme: usagehelpAn issue or change related to the usage help messageAn issue or change related to the usage help messagetype: question ❔