Package org.cojen.classfile.constant

Examples of org.cojen.classfile.constant.ConstantNameAndTypeInfo


                } catch (IndexOutOfBoundsException e) {
                    error(opcode, "Undefined constant at index: " + index);
                    break;
                }

                ConstantNameAndTypeInfo nameAndType;

                if (opcode == Opcode.INVOKEINTERFACE) {
                    // Read and ignore nargs and padding byte.
                    readShort();
                    if (!(ci instanceof ConstantInterfaceMethodInfo)) {
                        error(opcode, "Invalid constant type for method invocation: " + ci);
                        break;
                    }
                    ConstantInterfaceMethodInfo method = (ConstantInterfaceMethodInfo)ci;
                    className = method.getParentClass().getType().getFullName();
                    nameAndType = method.getNameAndType();
                } else if (opcode == Opcode.INVOKEDYNAMIC) {
                    // Read and ignore extra bytes.
                    readShort();
                    ConstantInterfaceMethodInfo method = (ConstantInterfaceMethodInfo)ci;
                    className = method.getParentClass().getType().getFullName();
                    nameAndType = method.getNameAndType();
                } else {
                    if (!(ci instanceof ConstantMethodInfo)) {
                        error(opcode, "Invalid constant type for method invocation: " + ci);
                        break;
                    }
                    ConstantMethodInfo method = (ConstantMethodInfo)ci;
                    className = method.getParentClass().getType().getFullName();
                    if (mEnclosingClassName.equals(className)) {
                        className = null;
                    }
                    nameAndType = method.getNameAndType();
                }

                String methodName = nameAndType.getName();
                desc = nameAndType.getType();
                if (!(desc instanceof MethodDesc)) {
                    error(opcode, "Invalid descriptor for method invocation: " + desc);
                    break;
                }
                TypeDesc ret = ((MethodDesc)desc).getReturnType();
View Full Code Here


    /**
     * Get or create a constant name and type structure from the constant pool.
     */
    public ConstantNameAndTypeInfo addConstantNameAndType(String name,
                                                          Descriptor type) {
        return (ConstantNameAndTypeInfo)addConstant(new ConstantNameAndTypeInfo(this, name, type));
    }
View Full Code Here

     * Get or create a constant name and type structure from the constant pool.
     */
    public ConstantNameAndTypeInfo addConstantNameAndType(ConstantUTFInfo nameConstant,
                                                          ConstantUTFInfo descConstant) {
        return (ConstantNameAndTypeInfo)addConstant
            (new ConstantNameAndTypeInfo(nameConstant, descConstant));
    }
View Full Code Here

            case ConstantInfo.TAG_INTERFACE_METHOD:
                ci = new ConstantInterfaceMethodInfo
                    ((ConstantClassInfo)ci2, (ConstantNameAndTypeInfo)ci1);
                break;
            case ConstantInfo.TAG_NAME_AND_TYPE:
                ci = new ConstantNameAndTypeInfo
                    ((ConstantUTFInfo)ci2, (ConstantUTFInfo)ci1);
                break;
            }

            break;
View Full Code Here

            case Opcode.INVOKEINTERFACE:
            case Opcode.INVOKEDYNAMIC:
                constant = getConstant(readUnsignedShort());

                String className;
                ConstantNameAndTypeInfo nameAndType;

                if (opcode == Opcode.INVOKEINTERFACE) {
                    // Read and ignore nargs and padding byte.
                    readShort();
                    if (!(constant instanceof ConstantInterfaceMethodInfo)) {
                        print(constant);
                        break;
                    }
                    ConstantInterfaceMethodInfo method =
                        (ConstantInterfaceMethodInfo)constant;
                    className =
                        method.getParentClass().getType().getFullName();
                    nameAndType = method.getNameAndType();
                } else if (opcode == Opcode.INVOKEDYNAMIC) {
                    // Read and ignore extra bytes.
                    readShort();
                    className = null;
                    nameAndType = (ConstantNameAndTypeInfo)constant;
                } else {
                    if (!(constant instanceof ConstantMethodInfo)) {
                        print(constant);
                        break;
                    }
                    ConstantMethodInfo method = (ConstantMethodInfo)constant;
                    className =
                        method.getParentClass().getType().getFullName();
                    nameAndType = method.getNameAndType();
                }

                Descriptor type = nameAndType.getType();
                if (!(type instanceof MethodDesc)) {
                    print(type);
                    break;
                }
                disassemble(((MethodDesc)type).getReturnType());
                print(" ");
                if (className != null) {
                    print(className);
                    print(".");
                }
                print(nameAndType.getName());

                print("(");
                TypeDesc[] params = ((MethodDesc)type).getParameterTypes();
                for (int i=0; i<params.length; i++) {
                    if (i > 0) {
View Full Code Here

            case Opcode.INVOKEINTERFACE:
            case Opcode.INVOKEDYNAMIC:
                constant = getConstant(readUnsignedShort());

                String className;
                ConstantNameAndTypeInfo nameAndType;

                if (opcode == Opcode.INVOKEINTERFACE) {
                    // Read and ignore nargs and padding byte.
                    readShort();
                    if (!(constant instanceof ConstantInterfaceMethodInfo)) {
                        print(constant);
                        break;
                    }
                    ConstantInterfaceMethodInfo method =
                        (ConstantInterfaceMethodInfo)constant;
                    className =
                        method.getParentClass().getType().getFullName();
                    nameAndType = method.getNameAndType();
                } else if (opcode == Opcode.INVOKEDYNAMIC) {
                    // Read and ignore extra bytes.
                    readShort();
                    className = null;
                    nameAndType = (ConstantNameAndTypeInfo)constant;
                } else {
                    if (!(constant instanceof ConstantMethodInfo)) {
                        print(constant);
                        break;
                    }
                    ConstantMethodInfo method = (ConstantMethodInfo)constant;
                    className =
                        method.getParentClass().getType().getFullName();
                    nameAndType = method.getNameAndType();
                }

                Descriptor type = nameAndType.getType();
                if (!(type instanceof MethodDesc)) {
                    print(type);
                    break;
                }
                disassemble(((MethodDesc)type).getReturnType());
                print(" ");
                if (className != null) {
                    print(className);
                    print(".");
                }
                print(nameAndType.getName());

                print("(");
                TypeDesc[] params = ((MethodDesc)type).getParameterTypes();
                for (int i=0; i<params.length; i++) {
                    if (i > 0) {
View Full Code Here

    /**
     * Get or create a constant name and type structure from the constant pool.
     */
    public ConstantNameAndTypeInfo addConstantNameAndType(String name,
                                                          Descriptor type) {
        return (ConstantNameAndTypeInfo)addConstant(new ConstantNameAndTypeInfo(this, name, type));
    }
View Full Code Here

     * Get or create a constant name and type structure from the constant pool.
     */
    public ConstantNameAndTypeInfo addConstantNameAndType(ConstantUTFInfo nameConstant,
                                                          ConstantUTFInfo descConstant) {
        return (ConstantNameAndTypeInfo)addConstant
            (new ConstantNameAndTypeInfo(nameConstant, descConstant));
    }
View Full Code Here

            case ConstantInfo.TAG_INTERFACE_METHOD:
                ci = new ConstantInterfaceMethodInfo
                    ((ConstantClassInfo)ci2, (ConstantNameAndTypeInfo)ci1);
                break;
            case ConstantInfo.TAG_NAME_AND_TYPE:
                ci = new ConstantNameAndTypeInfo
                    ((ConstantUTFInfo)ci2, (ConstantUTFInfo)ci1);
                break;
            }

            break;
View Full Code Here

                } catch (IndexOutOfBoundsException e) {
                    error(opcode, "Undefined constant at index: " + index);
                    break;
                }

                ConstantNameAndTypeInfo nameAndType;

                if (opcode == Opcode.INVOKEINTERFACE) {
                    // Read and ignore nargs and padding byte.
                    readShort();
                    if (!(ci instanceof ConstantInterfaceMethodInfo)) {
                        error(opcode, "Invalid constant type for method invocation: " + ci);
                        break;
                    }
                    ConstantInterfaceMethodInfo method = (ConstantInterfaceMethodInfo)ci;
                    className = method.getParentClass().getType().getFullName();
                    nameAndType = method.getNameAndType();
                } else if (opcode == Opcode.INVOKEDYNAMIC) {
                    // Read and ignore extra bytes.
                    readShort();
                    ConstantInterfaceMethodInfo method = (ConstantInterfaceMethodInfo)ci;
                    className = method.getParentClass().getType().getFullName();
                    nameAndType = method.getNameAndType();
                    System.out.println(nameAndType);
                } else {
                    if (!(ci instanceof ConstantMethodInfo)) {
                        error(opcode, "Invalid constant type for method invocation: " + ci);
                        break;
                    }
                    ConstantMethodInfo method = (ConstantMethodInfo)ci;
                    className = method.getParentClass().getType().getFullName();
                    if (mEnclosingClassName.equals(className)) {
                        className = null;
                    }
                    nameAndType = method.getNameAndType();
                }

                String methodName = nameAndType.getName();
                desc = nameAndType.getType();
                if (!(desc instanceof MethodDesc)) {
                    error(opcode, "Invalid descriptor for method invocation: " + desc);
                    break;
                }
                TypeDesc ret = ((MethodDesc)desc).getReturnType();
View Full Code Here

TOP

Related Classes of org.cojen.classfile.constant.ConstantNameAndTypeInfo

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.