Picocli 4.2.0 added support for injecting CommandSpec into custom IVersionProvider implementation classes.
However, the annotation processor raises a compile-time error with message @Spec must be enclosed in a @Command, but was <class> when a IVersionProvider implementation class has a @Spec-annotated field.
(picocli-codegen/src/main/java/picocli/codegen/annotation/processing/AbstractCommandSpecProcessor.java, line 843).
The workaround is to use variables like ${COMMAND-NAME} or ${COMMAND-FULL-NAME} in the returned version string.