Package org.objectweb.asm.commons

Examples of org.objectweb.asm.commons.GeneratorAdapter.invokeConstructor()


            GeneratorAdapter ga2 = new GeneratorAdapter(Opcodes.ACC_PUBLIC, sm,
                    null, ex, cw);

            ga2.loadThis();
            ga2.loadArgs();
            ga2.invokeConstructor(superType, m);
            ga2.returnValue();
            ga2.endMethod();
        }
    }
View Full Code Here


        GeneratorAdapter ga = new GeneratorAdapter(access, m, signature,
                toType(superConstructorExceptions), cw);

        ga.loadThis();
        ga.loadArgs(0, superConstructorParameterTypes.length);
        ga.invokeConstructor(Type.getType(constructor.getDeclaringClass()),
                super_m);

        ga.loadThis();
        ga.loadArg(superConstructorParameterTypes.length);
        ga.putField(selfType, INVOCATION_HANDLER_FIELD_NAME,
View Full Code Here

    @Override
    protected void createConstructor() {
        String declaration = "void <init> (" + method.getDeclaringClass().getName() + ")";
        GeneratorAdapter adapter = method(ACC_PUBLIC, asmMethod(declaration));
        adapter.loadThis();
        adapter.invokeConstructor(objectType, defaultConstructor);
        adapter.loadThis();
        adapter.loadArg(0);
        adapter.putField(outputType(), "receiver", receiverType);
        adapter.returnValue();
        adapter.endMethod();
View Full Code Here

    private void meaningfulToString() {
        GeneratorAdapter adapter = method(ACC_PUBLIC, toString);
        adapter.newInstance(stringBuilder);
        adapter.dup();
        adapter.invokeConstructor(stringBuilder, stringBuilderConstructor);
        adapter.push("[" + methodName() + " on ");
        adapter.invokeVirtual(stringBuilder, appendString);
        loadReceiver(adapter);
        adapter.invokeVirtual(stringBuilder, appendObject);
        adapter.push("]");
View Full Code Here

    private void staticInitializer() {
        GeneratorAdapter adapter = method(ACC_STATIC, asmMethod("void <clinit> ()"));
        adapter.newInstance(objectType);
        adapter.dup();
        adapter.invokeConstructor(objectType, defaultConstructor);
        adapter.putStatic(outputType(), "SIGNAL", objectType);
        adapter.returnValue();
        adapter.endMethod();
    }
View Full Code Here

    }

    private void constructorForPublishers() {
        GeneratorAdapter adapter = method(ACC_PUBLIC, asmConstructorMethod(methods.size()));
        adapter.loadThis();
        adapter.invokeConstructor(objectType, defaultConstructor);
        int arg = 0;

        for (int i = 0; i < methods.size(); i++) {
            adapter.loadThis();
            adapter.loadArg(arg++);
View Full Code Here

    GeneratorAdapter methodAdapter = new GeneratorAdapter(ACC_PUBLIC, m, null, null, cv);
    // loadthis
    methodAdapter.loadThis();
    // if we have java.* as a supertype call that zero args constructor
    if (superclassBinaryName.startsWith("java.") || superclassBinaryName.startsWith("javax.")) {
      methodAdapter.invokeConstructor(Type.getType(superclassClass), new Method("<init>",
          Type.VOID_TYPE, NO_ARGS));
    }
    else {
        try {
            //if the superclass has a no-arg constructor that we can call, we need to call it
View Full Code Here

            // otherwise invoke the java.lang.Object no args constructor.  However, that will fail
            // on the most recent versions of the JDK (1.6.0_u34 and 1.7.0_u5 and newer).  For the
            // newer JDK's, there is NOTHING we can do and the proxy will fail.
            Constructor<?> cons = superclassClass.getDeclaredConstructor();
            if (!Modifier.isPrivate(cons.getModifiers())) {
                methodAdapter.invokeConstructor(Type.getType(superclassClass), new Method("<init>", Type.VOID_TYPE, NO_ARGS));
            } else {
                methodAdapter.invokeConstructor(OBJECT_TYPE, new Method("<init>", Type.VOID_TYPE, NO_ARGS));
            }
        } catch (Exception e) {
            methodAdapter.invokeConstructor(OBJECT_TYPE, new Method("<init>", Type.VOID_TYPE, NO_ARGS));
View Full Code Here

            // newer JDK's, there is NOTHING we can do and the proxy will fail.
            Constructor<?> cons = superclassClass.getDeclaredConstructor();
            if (!Modifier.isPrivate(cons.getModifiers())) {
                methodAdapter.invokeConstructor(Type.getType(superclassClass), new Method("<init>", Type.VOID_TYPE, NO_ARGS));
            } else {
                methodAdapter.invokeConstructor(OBJECT_TYPE, new Method("<init>", Type.VOID_TYPE, NO_ARGS));
            }
        } catch (Exception e) {
            methodAdapter.invokeConstructor(OBJECT_TYPE, new Method("<init>", Type.VOID_TYPE, NO_ARGS));
        }
    }
View Full Code Here

                methodAdapter.invokeConstructor(Type.getType(superclassClass), new Method("<init>", Type.VOID_TYPE, NO_ARGS));
            } else {
                methodAdapter.invokeConstructor(OBJECT_TYPE, new Method("<init>", Type.VOID_TYPE, NO_ARGS));
            }
        } catch (Exception e) {
            methodAdapter.invokeConstructor(OBJECT_TYPE, new Method("<init>", Type.VOID_TYPE, NO_ARGS));
        }
    }
    // call from the constructor to setInvocationHandler
    Method setter = new Method("setInvocationHandler", Type.VOID_TYPE, new Type[] { IH_TYPE });
    // load this
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.