Examples of CodeAttr


Examples of gnu.bytecode.CodeAttr

        c.setSuper("java.lang.Object");
        c.setModifiers(Access.PUBLIC);
        c.setSourceFile("HelloWorld.java");

        Method m = c.addMethod("<init>", "()V", Access.PUBLIC);
        CodeAttr code = m.startCode();
        code.pushScope();
        code.emitPushThis();
        code.emitInvokeSpecial(objectCtor);
        code.emitReturn();
        code.popScope();

        m = c.addMethod("main", "([Ljava/lang/String;)V", Access.PUBLIC
                | Access.STATIC);
        code = m.startCode();
        code.pushScope();
        code.emitGetStatic(outField);
        code.emitPushString("Hello world!");
        code.emitInvokeVirtual(printlnMethod);
        code.emitReturn();
        code.popScope();

        return c.writeToArray();
    }
View Full Code Here

Examples of org.cojen.classfile.attribute.CodeAttr

        mModifiers = modifiers;
        mNameConstant = mCp.addConstantUTF(name);
        mDescriptorConstant = mCp.addConstantUTF(desc.getDescriptor());

        if (!modifiers.isAbstract() && !modifiers.isNative()) {
            addAttribute(new CodeAttr(mCp));
        }
    }
View Full Code Here

Examples of org.cojen.classfile.attribute.CodeAttr

                                         DataInput din) throws IOException {
            if (name.length() > 0) {
                switch (name.charAt(0)) {
                case 'C':
                    if (name.equals(CODE)) {
                        return new CodeAttr(cp, name, length, din, mAttrFactory);
                    } else if (name.equals(CONSTANT_VALUE)) {
                        return new ConstantValueAttr(cp, name, length, din);
                    }
                    break;
                case 'D':
View Full Code Here

Examples of org.cojen.classfile.attribute.CodeAttr

            }
            disassemble(modifiers);
            print(md.toMethodSignature(method.getName(), varargs));
        }

        CodeAttr code = method.getCodeAttr();

        TypeDesc[] exceptions = method.getExceptions();
        if (exceptions.length == 0) {
            if (code == null) {
                println(";");
View Full Code Here

Examples of org.cojen.classfile.attribute.CodeAttr

                                         DataInput din) throws IOException {
            if (name.length() > 0) {
                switch (name.charAt(0)) {
                case 'C':
                    if (name.equals(CODE)) {
                        return new CodeAttr(cp, name, length, din, mAttrFactory);
                    } else if (name.equals(CONSTANT_VALUE)) {
                        return new ConstantValueAttr(cp, name, length, din);
                    }
                    break;
                case 'D':
View Full Code Here

Examples of org.cojen.classfile.attribute.CodeAttr

            }
            disassemble(modifiers);
            print(md.toMethodSignature(method.getName(), varargs));
        }

        CodeAttr code = method.getCodeAttr();

        TypeDesc[] exceptions = method.getExceptions();
        if (exceptions.length == 0) {
            if (code == null) {
                println(";");
View Full Code Here

Examples of org.cojen.classfile.attribute.CodeAttr

        mModifiers = modifiers;
        mNameConstant = mCp.addConstantUTF(name);
        mDescriptorConstant = mCp.addConstantUTF(desc.getDescriptor());

        if (!modifiers.isAbstract() && !modifiers.isNative()) {
            addAttribute(new CodeAttr(mCp));
        }
    }
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.