Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.ConstantNameAndType


        }
    }

    public void addConstantFieldref(ConstantFieldref constant) {
        ConstantFieldref cf = constant;
        ConstantNameAndType cnat = (ConstantNameAndType) currentConstantPool
                .getConstant(cf.getNameAndTypeIndex());
        CPNameAndType nat = getCPNameAndType(cnat.getName(currentConstantPool),
                cnat.getSignature(currentConstantPool));
        cp_Field.add(new CPMethodOrField(getCPClass(cf
                .getClass(currentConstantPool)), nat));
    }
View Full Code Here


        }
    }

    public void addConstantInterfaceMethodref(
            ConstantInterfaceMethodref constant) {
        ConstantNameAndType cnat = (ConstantNameAndType) currentConstantPool
                .getConstant(constant.getNameAndTypeIndex());
        String signature = cnat.getSignature(currentConstantPool);
        CPNameAndType nat = getCPNameAndType(cnat.getName(currentConstantPool),
                signature);
        cp_Imethod.add(new CPMethodOrField(getCPClass(constant
                .getClass(currentConstantPool)), nat));
    }
View Full Code Here

            objectsToCPConstant.put(bigL, cpl);
        }
    }

    public void addConstantMethodref(ConstantMethodref constant) {
        ConstantNameAndType cnat = (ConstantNameAndType) currentConstantPool
                .getConstant(constant.getNameAndTypeIndex());
        String signature = cnat.getSignature(currentConstantPool);
        CPNameAndType nat = getCPNameAndType(cnat.getName(currentConstantPool),
                signature);
        cp_Method.add(new CPMethodOrField(getCPClass(constant
                .getClass(currentConstantPool)), nat));
    }
View Full Code Here

                if(aload_0) {
                    bytecode += 7;
                }
                if(className.equals(thisClass)) {
                    if(bytecode == 183) { // invokespecial
                        ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
                        String name = cnat.getName(cp);
                        if(name.equals("this")) {

                        }
                    }
                    bytecode += 24; // change to invokevirtual_this, invokespecial_this etc.
View Full Code Here

                    result.append(c.getNameAndTypeIndex());
                    result.append(";\t//  ");
                    result.append(Utility.replace(
                            constPool.constantToString(c), " ", ":"));
                } else if (constant instanceof ConstantNameAndType) {
                    ConstantNameAndType c = (ConstantNameAndType) constant;
                    result.append("NameAndType\t#");
                    result.append(c.getNameIndex());
                    result.append(":#");
                    result.append(c.getSignatureIndex());
                    result.append(";\t//  ");
                    result.append(Utility.replace(
                            constPool.constantToString(c), " ", ":"));
                } else if (constant instanceof ConstantMethodref) {
                    ConstantMethodref c = (ConstantMethodref) constant;
                    result.append("Method\t#");
                    result.append(c.getClassIndex());
                    result.append(".#");
                    result.append(c.getNameAndTypeIndex());
                    result.append(";\t//  ");
                    result.append(Utility.replace(
                            constPool.constantToString(c), " ", ":"));
                } else if (constant instanceof ConstantInterfaceMethodref) {
                    ConstantInterfaceMethodref c = (ConstantInterfaceMethodref) constant;
                    result.append("InterfaceMethod\t#");
                    result.append(c.getClassIndex());
                    result.append(".#");
                    result.append(c.getNameAndTypeIndex());
                    result.append(";\t//  ");
                    result.append(Utility.replace(
                            constPool.constantToString(c), " ", ":"));
                } else if (constant instanceof ConstantDouble) {
                    ConstantDouble c = (ConstantDouble) constant;
                    result.append("double\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantFloat) {
                    ConstantFloat c = (ConstantFloat) constant;
                    result.append("float\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantInteger) {
                    ConstantInteger c = (ConstantInteger) constant;
                    result.append("int\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantLong) {
                    ConstantLong c = (ConstantLong) constant;
                    result.append("long\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantClass) {
                    ConstantClass c = (ConstantClass) constant;
                    result.append("class\t#");
                    result.append(c.getNameIndex());
                    result.append(";\t//  ");
                    result.append(constPool.constantToString(c));
                } else if (constant instanceof ConstantString) {
                    ConstantString c = (ConstantString) constant;
                    result.append("String\t#");
                    result.append(c.getStringIndex());
                    result.append(";\t//  ");
                    result.append(constPool.constantToString(c));
                }

                result.append(n);
View Full Code Here

        return new ObjectType(sig.replace('/', '.'));
    }

    private Type[] getParamTypes(ConstantPool cp, int index) {
        ConstantCP cmr = (ConstantCP) cp.getConstant(index);
        ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
        String sig = ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getBytes();
        return Type.getArgumentTypes(sig);
    }
View Full Code Here

        return Type.getArgumentTypes(sig);
    }

    private Type getReturnType(ConstantPool cp, int index) {
        ConstantCP cmr = (ConstantCP) cp.getConstant(index);
        ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
        String sig = ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getBytes();
        return Type.getReturnType(sig);
    }
View Full Code Here

        return new ObjectType(sig.replace('/', '.'));
    }

    private Type[] getParamTypes(ConstantPool cp, int index) {
        ConstantCP cmr = (ConstantCP) cp.getConstant(index);
        ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
        String sig = ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getBytes();
        return Type.getArgumentTypes(sig);
    }
View Full Code Here

        return Type.getArgumentTypes(sig);
    }

    private Type getReturnType(ConstantPool cp, int index) {
        ConstantCP cmr = (ConstantCP) cp.getConstant(index);
        ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
        String sig = ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getBytes();
        return Type.getReturnType(sig);
    }
View Full Code Here

    /** @return signature of referenced method/field.
     */
    public String getSignature( ConstantPoolGen cpg ) {
        ConstantPool cp = cpg.getConstantPool();
        ConstantCP cmr = (ConstantCP) cp.getConstant(index);
        ConstantNameAndType cnat = (ConstantNameAndType) cp.getConstant(cmr.getNameAndTypeIndex());
        return ((ConstantUtf8) cp.getConstant(cnat.getSignatureIndex())).getBytes();
    }
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.ConstantNameAndType

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.