I have enum and annotation like:
enum Permission { user, superuser, admin }
@CompileStatic
@interface Anno {
Permission[] value
}
Now I want to supply a default value to value, which should be [ Permission.user ].
I tried different groovy tricks:
Permission[] value default [user]
Permission[] value default ([user] as Permission[])
Permission[] value default (Permission[])[user]
...
but none of them worked, so as a workaround I implemented the annotation in j4v4:
public @interface Anno {
Permission[] value default { user };
}
What am I missing?
UPDATE:
The solution was to remove @CompileStatic from the annotation.
With @CompileStatic the compile threw:
[Static type checking] - Cannot return value of type java.util.List <io.domain.Permission> on method returning type io.domain.Permission[]