users@codemodel.java.net

Re: How to create a method call with "generic binding"

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Tue, 16 Apr 2013 22:54:51 +0200

Hi,

from what I read from the current code, this does not seem to be
possible. You get a JInvocation and it does not seem to support
generics.

directStatement is, as always the last retreat.

Best wishes,
Alexey

On Tue, Apr 16, 2013 at 4:54 PM, Romain Vimont (Žom) <rom_at_rom1v.com> wrote:
> Hi,
>
> If I have a method:
>
> public class MyClass {
>
> public static <T> T method() { … }
>
> }
>
> How can I create the model of this method call:
>
> MyType t = MyClass.<MyType>method();
>
> ?
>
> JClass.staticInvoke(String method) does not seem to support it.
> I tried to workaround passing "<mypackage.MyType>method()" as a String, but
> it refuses a method name containing a dot (which seems fair).
>
> Thank you for your help.
> Žom