From fd489e990cd4d406a20bd9b46eb13f83494ae8f0 Mon Sep 17 00:00:00 2001 From: Ben Gruver Date: Thu, 18 Jun 2015 17:44:30 -0700 Subject: [PATCH] Add backwards compatible version of DexFileFactory.loadDexFile and Opcodes Keep the old prototype, so we don't break existing code. --- .../src/main/java/org/jf/dexlib2/DexFileFactory.java | 11 +++++++++++ .../dexlib2/src/main/java/org/jf/dexlib2/Opcodes.java | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/brut.apktool.smali/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java b/brut.apktool.smali/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java index a1ddee2e..113b60a3 100644 --- a/brut.apktool.smali/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java +++ b/brut.apktool.smali/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java @@ -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 { diff --git a/brut.apktool.smali/dexlib2/src/main/java/org/jf/dexlib2/Opcodes.java b/brut.apktool.smali/dexlib2/src/main/java/org/jf/dexlib2/Opcodes.java index dd876813..e718e275 100644 --- a/brut.apktool.smali/dexlib2/src/main/java/org/jf/dexlib2/Opcodes.java +++ b/brut.apktool.smali/dexlib2/src/main/java/org/jf/dexlib2/Opcodes.java @@ -40,6 +40,10 @@ public class Opcodes { private final Opcode[] opcodesByValue; private final HashMap opcodesByName; + public Opcodes(int api) { + this(api, false); + } + public Opcodes(int api, boolean experimental) { opcodesByValue = new Opcode[256]; opcodesByName = Maps.newHashMap();