Methods Summary |
---|
private void | addClassWithHierachy(java.lang.String classBinaryName)
if (classNames.contains(classBinaryName)) {
return;
}
try {
DirectClassFile classFile = path.getClass(classBinaryName + CLASS_EXTENSION);
classNames.add(classBinaryName);
CstType superClass = classFile.getSuperclass();
if (superClass != null) {
addClassWithHierachy(superClass.getClassType().getClassName());
}
TypeList interfaceList = classFile.getInterfaces();
int interfaceNumber = interfaceList.size();
for (int i = 0; i < interfaceNumber; i++) {
addClassWithHierachy(interfaceList.getType(i).getClassName());
}
} catch (FileNotFoundException e) {
// Ignore: The referenced type is not in the path it must be part of the libraries.
}
|
private void | addDependencies(com.android.dx.rop.cst.ConstantPool pool)
for (Constant constant : pool.getEntries()) {
if (constant instanceof CstType) {
Type type = ((CstType) constant).getClassType();
String descriptor = type.getDescriptor();
if (descriptor.endsWith(";")) {
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));
}
}
}
}
|
public void | addRoots(java.util.zip.ZipFile jarOfRoots)
// keep roots
for (Enumeration<? extends ZipEntry> entries = jarOfRoots.entries();
entries.hasMoreElements();) {
ZipEntry entry = entries.nextElement();
String name = entry.getName();
if (name.endsWith(CLASS_EXTENSION)) {
classNames.add(name.substring(0, name.length() - CLASS_EXTENSION.length()));
}
}
// keep direct references of roots (+ direct references hierarchy)
for (Enumeration<? extends ZipEntry> entries = jarOfRoots.entries();
entries.hasMoreElements();) {
ZipEntry entry = entries.nextElement();
String name = entry.getName();
if (name.endsWith(CLASS_EXTENSION)) {
DirectClassFile classFile;
try {
classFile = path.getClass(name);
} catch (FileNotFoundException e) {
throw new IOException("Class " + name +
" is missing form original class path " + path, e);
}
addDependencies(classFile.getConstantPool());
}
}
|
java.util.Set | getClassNames()
return classNames;
|
public static void | main(java.lang.String[] args)Kept for compatibility with the gradle integration, this method just forwards to
{@link MainDexListBuilder#main(String[])}.
MainDexListBuilder.main(args);
|