The workaround is not to use static compilation for the annotation; it wouldn't do anything anyway.
On Tue, Apr 15, 2025, 18:53 Saravanan Palanichamy <chava...@gmail.com> wrote: > It's under Static compilation. I have raised a ticket for this issue. I am > not sure if there are any work arounds for this issue > > regards > Saravanan > > On Tue, Apr 15, 2025 at 6:32 PM Milles, Eric (TR Technology) via dev < > dev@groovy.apache.org> wrote: > >> You should be able to use "default []". I don't think it supports >> "default new Class[0]". Is this under Static Type Checking or Static >> Compilation? >> >> NOTE: https://issues.apache.org/jira/browse/GROOVY-11492 item 3 covers >> the missing "default {}" support. >> >> >> ------------------------------ >> *From:* Saravanan Palanichamy <chava...@gmail.com> >> *Sent:* Tuesday, April 15, 2025 4:21 AM >> *To:* us...@groovy.apache.org <us...@groovy.apache.org>; >> dev@groovy.apache.org <dev@groovy.apache.org> >> *Subject:* [EXT] Default for annotation members with type class >> >> *External Email:* Use caution with links and attachments. >> >> 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 >> >