Package net.sourceforge.htmlunit.corejs.classfile

Examples of net.sourceforge.htmlunit.corejs.classfile.ClassFileWriter


   
   
    private static byte[] loadBytecode()
    {
        String secureCallerClassName = SecureCaller.class.getName();
        ClassFileWriter cfw = new ClassFileWriter(
                secureCallerClassName + "Impl", secureCallerClassName,
                "<generated>");
        cfw.startMethod("<init>", "()V", ClassFileWriter.ACC_PUBLIC);
        cfw.addALoad(0);
        cfw.addInvoke(ByteCode.INVOKESPECIAL, secureCallerClassName,
                "<init>", "()V");
        cfw.add(ByteCode.RETURN);
        cfw.stopMethod((short)1);
        String callableCallSig =
            "Lnet/sourceforge/htmlunit/corejs/javascript/Context;" +
            "Lnet/sourceforge/htmlunit/corejs/javascript/Scriptable;" +
            "Lnet/sourceforge/htmlunit/corejs/javascript/Scriptable;" +
            "[Ljava/lang/Object;)Ljava/lang/Object;";
       
        cfw.startMethod("call",
                "(Lnet/sourceforge/htmlunit/corejs/javascript/Callable;" + callableCallSig,
                (short)(ClassFileWriter.ACC_PUBLIC
                        | ClassFileWriter.ACC_FINAL));
        for(int i = 1; i < 6; ++i) {
            cfw.addALoad(i);
        }
        cfw.addInvoke(ByteCode.INVOKEINTERFACE,
                "net/sourceforge/htmlunit/corejs/javascript/Callable", "call",
                "(" + callableCallSig);
        cfw.add(ByteCode.ARETURN);
        cfw.stopMethod((short)6);
        return cfw.toByteArray();
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.htmlunit.corejs.classfile.ClassFileWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.