TypeId(com.android.dx.rop.type.Type ropType) { this(ropType.getDescriptor(), ropType); }
private void checkDescriptor(Type type) { String descriptor = type.getDescriptor(); if (descriptor.endsWith(";")) { // System.out.println("=====descriptor:" + descriptor); int lastBrace = descriptor.lastIndexOf('['); if (lastBrace < 0) { addClassWithHierachy(descriptor.substring(1, descriptor.length() - 1)); } else { assert descriptor.length() > lastBrace + 3 && descriptor.charAt(lastBrace + 1) == 'L'; addClassWithHierachy(descriptor.substring(lastBrace + 2, descriptor.length() - 1)); } } }
private void checkPrototype(Prototype proto) { checkDescriptor(proto.getReturnType().getDescriptor()); StdTypeList args = proto.getParameterTypes(); for (int i = 0; i < args.size(); i++) { checkDescriptor(args.get(i).getDescriptor()); } } private void checkDescriptor(String typeDescriptor) {
private void addDependencies(DirectClassFile classFile) { for (Constant constant : classFile.getConstantPool().getEntries()) { if (constant instanceof CstType) { checkDescriptor(((CstType) constant).getClassType().getDescriptor()); } else if (constant instanceof CstFieldRef) { checkDescriptor(((CstFieldRef) constant).getType().getDescriptor()); } else if (constant instanceof CstBaseMethodRef) { checkPrototype(((CstBaseMethodRef) constant).getPrototype()); } } FieldList fields = classFile.getFields(); int nbField = fields.size(); for (int i = 0; i < nbField; i++) { checkDescriptor(fields.get(i).getDescriptor().getString()); } MethodList methods = classFile.getMethods(); int nbMethods = methods.size(); for (int i = 0; i < nbMethods; i++) { checkPrototype(Prototype.intern(methods.get(i).getDescriptor().getString())); } } private void checkPrototype(Prototype proto) {
/** {@inheritDoc} */ @Override protected int compareTo0(Constant other) { String thisDescriptor = type.getDescriptor(); String otherDescriptor = ((CstType) other).type.getDescriptor(); return thisDescriptor.compareTo(otherDescriptor); }
/** {@inheritDoc} */ @Override protected int compareTo0(Constant other) { String thisDescriptor = type.getDescriptor(); String otherDescriptor = ((CstType) other).type.getDescriptor(); return thisDescriptor.compareTo(otherDescriptor); }
/** {@inheritDoc} */ @Override protected int compareTo0(Constant other) { String thisDescriptor = type.getDescriptor(); String otherDescriptor = ((CstType) other).type.getDescriptor(); return thisDescriptor.compareTo(otherDescriptor); }
/** {@inheritDoc} */ @Override protected int compareTo0(Constant other) { String thisDescriptor = type.getDescriptor(); String otherDescriptor = ((CstType) other).type.getDescriptor(); return thisDescriptor.compareTo(otherDescriptor); }
/** {@inheritDoc} */ @Override protected int compareTo0(Constant other) { String thisDescriptor = type.getDescriptor(); String otherDescriptor = ((CstType) other).type.getDescriptor(); return thisDescriptor.compareTo(otherDescriptor); }
/** {@inheritDoc} */ @Override protected int compareTo0(Constant other) { String thisDescriptor = type.getDescriptor(); String otherDescriptor = ((CstType) other).type.getDescriptor(); return thisDescriptor.compareTo(otherDescriptor); }
/** * Puts the given instance in the intern table if it's not already * there. If a conflicting value is already in the table, then leave it. * Return the interned value. * * @param type {@code non-null;} instance to make interned * @return {@code non-null;} the actual interned object */ private static Type putIntern(Type type) { Type result = internTable.putIfAbsent(type.getDescriptor(), type); return result != null ? result : type; }
/** * Puts the given instance in the intern table if it's not already * there. If a conflicting value is already in the table, then leave it. * Return the interned value. * * @param type {@code non-null;} instance to make interned * @return {@code non-null;} the actual interned object */ private static Type putIntern(Type type) { Type result = internTable.putIfAbsent(type.getDescriptor(), type); return result != null ? result : type; }
/** * Puts the given instance in the intern table if it's not already * there. If a conflicting value is already in the table, then leave it. * Return the interned value. * * @param type {@code non-null;} instance to make interned * @return {@code non-null;} the actual interned object */ private static Type putIntern(Type type) { Type result = internTable.putIfAbsent(type.getDescriptor(), type); return result != null ? result : type; } }
/** * Gets the short-form character for the given type. * * @param type {@code non-null;} the type * @return the corresponding short-form character */ private static char shortFormCharFor(Type type) { char descriptorChar = type.getDescriptor().charAt(0); if (descriptorChar == '[') { return 'L'; } return descriptorChar; }
/** * Gets the type descriptor for this instance. * * @return {@code non-null;} the descriptor */ public CstString getDescriptor() { if (descriptor == null) { descriptor = new CstString(type.getDescriptor()); } return descriptor; }
/** * Gets the type descriptor for this instance. * * @return {@code non-null;} the descriptor */ public CstString getDescriptor() { if (descriptor == null) { descriptor = new CstString(type.getDescriptor()); } return descriptor; }
/** * Gets the type descriptor for this instance. * * @return {@code non-null;} the descriptor */ public CstString getDescriptor() { if (descriptor == null) { descriptor = new CstString(type.getDescriptor()); } return descriptor; }
/** * Gets the type descriptor for this instance. * * @return {@code non-null;} the descriptor */ public CstString getDescriptor() { if (descriptor == null) { descriptor = new CstString(type.getDescriptor()); } return descriptor; } }
/** * Gets the type descriptor for this instance. * * @return {@code non-null;} the descriptor */ public CstUtf8 getDescriptor() { if (descriptor == null) { descriptor = new CstUtf8(type.getDescriptor()); } return descriptor; } }
private void checkPrototype(Prototype proto) { checkDescriptor(proto.getReturnType().getDescriptor()); StdTypeList args = proto.getParameterTypes(); for (int i = 0; i < args.size(); i++) { checkDescriptor(args.get(i).getDescriptor()); } }