Closure params hint

Saravanan Palanichamy <[email protected]>
Newsgroups gmane.comp.lang.groovy.user
Message-ID <CAG3fL7nJUK-gATLmPxDGMtH3dq7NTY7uO5rLLHPoHhQ+8xo+jQ@mail.gmail.com>
Hello Everyone

   I am trying to define a method that will take a closure whose parameters
are a generic type based on generic parameters on the function. The closure
returns void

class Result<K, V> {
>     public Map<K, V> pairs;
> }
>
> class MyOtherClass {
>     // This closure takes an input of Result<T1, T2>
>     static <T1, T2> void make(@ClosureParams(...) Closure<Void> myClosure) {}
> }
>
>
>
I am trying to understand what to use in closure params. I tried

> @ClosureParams(FromString, options = "com.myGroovy.model.Results<I, R>")
>
> But this resulted in Results<Object, String> instead of <String, String>
as shown below

[image: Screenshot 2023-03-20 at 11.09.00 AM.png]

Any ideas on how to define this?


regards
Screenshot 2023-03-20 at 11.09.00 AM.png (image/png, 44 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.