1

Java でメソッド ルックアップの MethodType を作成できませんでした。以下は私のコードです。このコードでは、sample::gwd メソッドの MethodType を作成し、lookup().findStatic でこの関数への参照を取得します。MethodType が間違って構築されているため、メソッド参照を取得できないことは明らかです。

//I want to construct MethodType for Sample:gwd method, but do not know how to handle array parameters for 'gwd' method
MethodType mt = MethodType.methodType(Object.class, MethodHandle.class, MethodHandle.class, MethodHandle.class);

MethodHandle myMH = MethodHandles.lookup().findStatic(Sample.Class, "gwd", mt);

public class Sample
{
    public static Object gwd(MethodHandle methodhandle, MethodHandle methodhandle1, MethodHandle methodhandle2, Object aobj[])
        throws Throwable
    {  ..........   }
}

誰でもそれを助けることができます? ありがとう

4

1 に答える 1