Daml codegen --root argument not working

I have tried running daml codegen for java, as follows but the -r or --root argument seems to be ignored. I’m using sdk 2.6.0. It just does the codegen for all the templates in the DAR even with -r option set.

daml codegen java -o output -r 'Only\.This\.Package\..*' /path/to/my-package.dar