TypeId(String name, com.android.dx.rop.type.Type ropType) { if (name == null || ropType == null) { throw new NullPointerException(); } this.name = name; this.ropType = ropType; this.constant = CstType.intern(ropType); }
public void addSupperClass(String name){ if (name.endsWith(CLASS_EXTENSION)) { classNames.add(name.substring(0, name.length() - CLASS_EXTENSION.length())); } if (name.endsWith(CLASS_EXTENSION)) { DirectClassFile classFile; try { classFile = path.getClass(name); CstType superClass = classFile.getSuperclass(); if (superClass != null) { String superClassName=superClass.getClassType().getClassName(); classNames.add(superClassName); } } catch (FileNotFoundException e) { // throw new IOException("Class " + name + // " is missing form original class path " + path, e); } } } public void addRootsV2(String name){
/** {@inheritDoc} */ @Override public int compareTo(Entry other) { if (handler < other.handler) { return -1; } else if (handler > other.handler) { return 1; } return exceptionType.compareTo(other.exceptionType); }
/** {@inheritDoc} */ @Override public int hashCode() { return (handler * 31) + exceptionType.hashCode(); }
/** {@inheritDoc} */ @Override public final boolean equals(Object other) { if ((other == null) || (getClass() != other.getClass())) { return false; } CstMemberRef otherRef = (CstMemberRef) other; return definingClass.equals(otherRef.definingClass) && nat.equals(otherRef.nat); }
/** {@inheritDoc} */ @Override public String toString() { return "type{" + toHuman() + '}'; }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { file.getStringIds().intern(getDefiningClass().getDescriptor()); }
/** * Returns an instance of this class that represents the static * field which should hold the class corresponding to a given * primitive type. For example, if given {@link Type#INT}, this * method returns an instance corresponding to the field * {@code java.lang.Integer.TYPE}. * * @param primitiveType {@code non-null;} the primitive type * @return {@code non-null;} the corresponding static field */ public static CstFieldRef forPrimitiveType(Type primitiveType) { return new CstFieldRef(CstType.forBoxedPrimitiveType(primitiveType), CstNat.PRIMITIVE_TYPE_NAT); }
private String getTooManyMembersMessage() { Map<String, AtomicInteger> membersByPackage = new TreeMap<String, AtomicInteger>(); for (Object member : items()) { String packageName = ((MemberIdItem) member).getDefiningClass().getPackageName(); AtomicInteger count = membersByPackage.get(packageName); if (count == null) { count = new AtomicInteger(); membersByPackage.put(packageName, count); } count.incrementAndGet(); } Formatter formatter = new Formatter(); try { String memberType = this instanceof MethodIdsSection ? "method" : "field"; formatter.format("Too many %1$s references to fit in one dex file: %2$d; max is %3$d.%n" + "You may try using multi-dex. If multi-dex is enabled then the list of " + "classes for the main dex list is too large.%n" + "References by package:", memberType, items().size(), DexFormat.MAX_MEMBER_IDX + 1); for (Map.Entry<String, AtomicInteger> entry : membersByPackage.entrySet()) { formatter.format("%n%6d %s", entry.getValue().get(), entry.getKey()); } return formatter.toString(); } finally { formatter.close(); } }
/** {@inheritDoc} */ public int compareTo(Entry other) { if (handler < other.handler) { return -1; } else if (handler > other.handler) { return 1; } return exceptionType.compareTo(other.exceptionType); }
/** {@inheritDoc} */ @Override public int hashCode() { return (handler * 31) + exceptionType.hashCode(); }
/** {@inheritDoc} */ @Override public final boolean equals(Object other) { if ((other == null) || (getClass() != other.getClass())) { return false; } CstMemberRef otherRef = (CstMemberRef) other; return definingClass.equals(otherRef.definingClass) && nat.equals(otherRef.nat); }
/** {@inheritDoc} */ @Override public String toString() { return "type{" + toHuman() + '}'; }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { file.getStringIds().intern(getDefiningClass().getDescriptor()); }
/** * Returns an instance of this class that represents the static * field which should hold the class corresponding to a given * primitive type. For example, if given {@link Type#INT}, this * method returns an instance corresponding to the field * {@code java.lang.Integer.TYPE}. * * @param primitiveType {@code non-null;} the primitive type * @return {@code non-null;} the corresponding static field */ public static CstFieldRef forPrimitiveType(Type primitiveType) { return new CstFieldRef(CstType.forBoxedPrimitiveType(primitiveType), CstNat.PRIMITIVE_TYPE_NAT); }
private String getTooManyMembersMessage() { Map<String, AtomicInteger> membersByPackage = new TreeMap<String, AtomicInteger>(); for (Object member : items()) { String packageName = ((MemberIdItem) member).getDefiningClass().getPackageName(); AtomicInteger count = membersByPackage.get(packageName); if (count == null) { count = new AtomicInteger(); membersByPackage.put(packageName, count); } count.incrementAndGet(); } Formatter formatter = new Formatter(); try { String memberType = this instanceof MethodIdsSection ? "method" : "field"; formatter.format("Too many %1$s references to fit in one dex file: %2$d; max is %3$d.%n" + "You may try using multi-dex. If multi-dex is enabled then the list of " + "classes for the main dex list is too large.%n" + "References by package:", memberType, items().size(), DexFormat.MAX_MEMBER_IDX + 1); for (Map.Entry<String, AtomicInteger> entry : membersByPackage.entrySet()) { formatter.format("%n%6d %s", entry.getValue().get(), entry.getKey()); } return formatter.toString(); } finally { formatter.close(); } }
} else { CstType cstType = CstType.intern(type.ropType);
/** * Returns an interned instance of this class for the given type. * * @param type {@code non-null;} the underlying type * @return {@code non-null;} an appropriately-constructed instance */ public static CstType intern(Type type) { CstType cst = new CstType(type); CstType result = interns.putIfAbsent(type, cst); return result != null ? result : cst; }
addClassWithHierachy(superClass.getClassType().getClassName());