Package com.android.dx.rop.cst

Examples of com.android.dx.rop.cst.CstNat


            throw new NullPointerException();
        }
        this.declaringType = declaringType;
        this.type = type;
        this.name = name;
        this.nat = new CstNat(new CstString(name), new CstString(type.name));
        this.constant = new CstFieldRef(declaringType.constant, nat);
    }
View Full Code Here


        }
        this.declaringType = declaringType;
        this.returnType = returnType;
        this.name = name;
        this.parameters = parameters;
        this.nat = new CstNat(new CstString(name), new CstString(descriptor(false)));
        this.constant = new CstMethodRef(declaringType.constant, nat);
    }
View Full Code Here

    /** {@inheritDoc} */
    @Override
    public final void writeTo(DexFile file, AnnotatedOutput out) {
        TypeIdsSection typeIds = file.getTypeIds();
        StringIdsSection stringIds = file.getStringIds();
        CstNat nat = cst.getNat();
        int classIdx = typeIds.indexOf(getDefiningClass());
        int nameIdx = stringIds.indexOf(nat.getName());
        int typoidIdx = getTypoidIdx(file);

        if (out.annotates()) {
            out.annotate(0, indexString() + ' ' + cst.toHuman());
            out.annotate(2, "  class_idx: " + Hex.u2(classIdx));
View Full Code Here

                }
                case CONSTANT_Fieldref: {
                    int classIndex = bytes.getUnsignedShort(at + 1);
                    CstType type = (CstType) parse0(classIndex);
                    int natIndex = bytes.getUnsignedShort(at + 3);
                    CstNat nat = (CstNat) parse0(natIndex);
                    cst = new CstFieldRef(type, nat);
                    break;
                }
                case CONSTANT_Methodref: {
                    int classIndex = bytes.getUnsignedShort(at + 1);
                    CstType type = (CstType) parse0(classIndex);
                    int natIndex = bytes.getUnsignedShort(at + 3);
                    CstNat nat = (CstNat) parse0(natIndex);
                    cst = new CstMethodRef(type, nat);
                    break;
                }
                case CONSTANT_InterfaceMethodref: {
                    int classIndex = bytes.getUnsignedShort(at + 1);
                    CstType type = (CstType) parse0(classIndex);
                    int natIndex = bytes.getUnsignedShort(at + 3);
                    CstNat nat = (CstNat) parse0(natIndex);
                    cst = new CstInterfaceMethodRef(type, nat);
                    break;
                }
                case CONSTANT_NameAndType: {
                    int nameIndex = bytes.getUnsignedShort(at + 1);
                    CstUtf8 name = (CstUtf8) parse0(nameIndex);
                    int descriptorIndex = bytes.getUnsignedShort(at + 3);
                    CstUtf8 descriptor = (CstUtf8) parse0(descriptorIndex);
                    cst = new CstNat(name, descriptor);
                    break;
                }
            }
        } catch (ParseException ex) {
            ex.addContext("...while parsing cst " + Hex.u2(idx) +
View Full Code Here

        int idx = bytes.getUnsignedShort(offset);
        CstType type = (CstType) pool.get(idx);

        idx = bytes.getUnsignedShort(offset + 2);
        CstNat method = (CstNat) pool.get0Ok(idx);

        Attribute result = new AttEnclosingMethod(type, method);

        if (observer != null) {
            observer.parsed(bytes, offset, 2, "class: " + type);
View Full Code Here

                if (observer != null) {
                    parsed(2, "type_name: " + typeName.toHuman());
                    parsed(2, "const_name: " + constName.toHuman());
                }

                return new CstEnumRef(new CstNat(constName, typeName));
            }
            case '@': {
                Annotation annotation =
                    parseAnnotation(AnnotationVisibility.EMBEDDED);
                return new CstAnnotation(annotation);
View Full Code Here

                                            attributeFactory);
                parser.setObserver(observer);
                at = parser.getEndOffset();
                StdAttributeList attributes = parser.getList();
                attributes.setImmutable();
                CstNat nat = new CstNat(name, desc);
                Member member = set(i, accessFlags, nat, attributes);

                if (observer != null) {
                    observer.changeIndent(-1);
                    observer.parsed(bytes, at, 0, "end " + humanName() +
View Full Code Here

        if (enclosingMethod == null) {
            return null;
        }

        CstType enclosingClass = enclosingMethod.getEnclosingClass();
        CstNat nat = enclosingMethod.getMethod();

        if (nat == null) {
            /*
             * Dalvik doesn't use EnclosingMethod annotations unless
             * there really is an enclosing method. Anonymous classes
View Full Code Here

    AttEnclosingMethod enclosingMethodAnnotation= (AttEnclosingMethod) cf.getAttributes().findFirst(AttEnclosingMethod.ATTRIBUTE_NAME);

    if (enclosingMethodAnnotation != null)
    {
      CstType enclosingClass= enclosingMethodAnnotation.getEnclosingClass();
      CstNat enclosingMethod= enclosingMethodAnnotation.getMethod();
      if (enclosingClass != null)
      {
        addReference(referencedTypes, enclosingClass.toHuman(), ReferenceKind.USAGE);
        classElement.setAttribute("enclosingClass", enclosingClass.toHuman());
      }
      if (enclosingMethod != null)
      {
        classElement.setAttribute("enclosingMethod", enclosingMethod.toHuman());
      }
    }

    // get signature annotation if availabke
    AttSignature signatureAnnotation= (AttSignature) cf.getAttributes().findFirst(AttSignature.ATTRIBUTE_NAME);
View Full Code Here

          CstMemberRef memberRef= (CstMemberRef) constant;
          String definingClassType= memberRef.getDefiningClass().getClassType().toHuman();

          dexInstruction.setAttribute("class-type", definingClassType);
          addReference(referencedTypes, definingClassType, ReferenceKind.USAGE);
          CstNat nameAndType= memberRef.getNat();
          String memberType= nameAndType.getFieldType().getType().toHuman();
          dexInstruction.setAttribute("member-type", memberType);
          addReference(referencedTypes, memberType, ReferenceKind.USAGE);
          String memberName= nameAndType.getName().toHuman();
          dexInstruction.setAttribute("member-name", memberName);

          // if this is a member access to a red class, we need to
          // eliminate it.
          if (isRedType(definingClassType))
View Full Code Here

TOP

Related Classes of com.android.dx.rop.cst.CstNat

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.