package com.ninty.nativee.lang.invoke;

import com.ninty.nativee.INativeMethod;
import com.ninty.nativee.NaMethodManager;
import com.ninty.runtime.NiFrame;

public class NaMethodHandleNatives {
    private final static String className = "java/lang/invoke/MethodHandleNatives";

    public static void init() {
        NaMethodManager.register(className, "getConstant", "(I)I", new
                getConstant());
    }

    public static class getConstant implements INativeMethod {

        @Override
        public void invoke(NiFrame frame) {
            int which = frame.getLocalVars().getInt(0);
            frame.getOperandStack().pushInt(which == 4 ? 1 : 0);
        }
    }
}

@@ -148,16 +148,56 @@
 NiFrame;
+%0Aimport com.ninty.runtime.heap.NiObject;
 %0A%0Apublic
@@ -447,16 +447,184 @@
 ant());%0A
+        NaMethodManager.register(className, %22resolve%22, %22(Ljava/lang/invoke/MemberName;Ljava/lang/Class;)Ljava/lang/invoke/MemberName;%22, new%0A                resolve());%0A
     %7D%0A%0A 
@@ -800,24 +800,24 @@
 .getInt(0);%0A
-
             
@@ -884,11 +884,273 @@
  %7D%0A    %7D
+%0A%0A    public static class resolve implements INativeMethod %7B%0A%0A        @Override%0A        public void invoke(NiFrame frame) %7B%0A            NiObject memberName = frame.getLocalVars().getRef(0);%0A            frame.getOperandStack().pushRef(memberName);%0A        %7D%0A    %7D
 %0A%7D%0A

add native method: java.lang.invoke.MethodHandleNatives.resolve(Ljava/lang/invoke/MemberName;Ljava/lang/Class;)Ljava/lang/invoke/MemberName;