Default for annotation members with type class
Saravanan Palanichamy <[email protected]> Tue, 15 Apr 2025 14:51:31 +0530
| Newsgroups | gmane.comp.lang.groovy.user |
|---|---|
| Message-ID | <CAG3fL7kRVT_=GYvDuwzLeR9JnP+678pxjzgcbgKpERb3fkbJrQ@mail.gmail.com> |
Hello Groovy users
What is the right way to define this java annotation in groovy? I am
testing this out in Groovy 5.0, I have not tried 4.x.
I tried using [] after the default keyword, but I get the error
"Cannot return value of type java.util.ArrayList<#E> for method returning
java.lang.Class<?>[]" and
"Cannot return value of type java.util.ArrayList<#E> for method returning
java.lang.Class<? extends MyClazz>[]"
@Target({ ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAnnotation {
Class<?>[] groups() default {};
Class<? extends MyClazz>[] payloads() default {};
}
regards
Saravanan