Add backwards compatible version of DexFileFactory.loadDexFile and Opcodes

Keep the old prototype, so we don't break existing code.
This commit is contained in:
Ben Gruver 2015-06-18 17:44:30 -07:00 committed by Connor Tumbleson
parent 008b12f97c
commit fd489e990c
2 changed files with 15 additions and 0 deletions

View File

@ -44,12 +44,23 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
public final class DexFileFactory {
@Nonnull
public static DexBackedDexFile loadDexFile(String path, int api)
throws IOException {
return loadDexFile(path, api, false);
}
@Nonnull
public static DexBackedDexFile loadDexFile(String path, int api, boolean experimental)
throws IOException {
return loadDexFile(new File(path), "classes.dex", new Opcodes(api, experimental));
}
@Nonnull
public static DexBackedDexFile loadDexFile(File dexFile, int api) throws IOException {
return loadDexFile(dexFile, api, false);
}
@Nonnull
public static DexBackedDexFile loadDexFile(File dexFile, int api, boolean experimental)
throws IOException {

View File

@ -40,6 +40,10 @@ public class Opcodes {
private final Opcode[] opcodesByValue;
private final HashMap<String, Opcode> opcodesByName;
public Opcodes(int api) {
this(api, false);
}
public Opcodes(int api, boolean experimental) {
opcodesByValue = new Opcode[256];
opcodesByName = Maps.newHashMap();