From 0a7f00ccb1c4d254d62275c38533f72eea8cd6fb Mon Sep 17 00:00:00 2001 From: Ben Gruver Date: Sun, 12 May 2013 20:59:50 -0700 Subject: [PATCH] Use Iterable instead of DexFile[] in ClassPath constructor --- .../org/jf/dexlib2/analysis/ClassPath.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/dexlib2/src/main/java/org/jf/dexlib2/analysis/ClassPath.java b/dexlib2/src/main/java/org/jf/dexlib2/analysis/ClassPath.java index 7cd72b0c..e7081523 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/analysis/ClassPath.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/analysis/ClassPath.java @@ -65,7 +65,7 @@ public class ClassPath { * @param classPath An array of DexFile objects. When loading a class, these dex files will be searched in order */ public ClassPath(DexFile... classPath) throws IOException { - this(classPath, true, 15); + this(Lists.newArrayList(classPath), 15); } /** @@ -74,20 +74,9 @@ public class ClassPath { * @param classPath An iterable of DexFile objects. When loading a class, these dex files will be searched in order * @param api API level */ - public ClassPath(Iterable classPath, int api) { - this(Iterables.toArray(classPath, DexFile.class), false, api); - } - - private ClassPath(@Nonnull DexFile[] classPath, boolean copyArray, int api) { - DexFile[] dexFiles; - if (copyArray) { - dexFiles = new DexFile[classPath.length+1]; - System.arraycopy(classPath, 0, dexFiles, 0, classPath.length); - // add fallbacks for certain special classes that must be present - dexFiles[dexFiles.length - 1] = getBasicClasses(); - } else { - dexFiles = classPath; - } + public ClassPath(@Nonnull Iterable classPath, int api) { + // add fallbacks for certain special classes that must be present + Iterable dexFiles = Iterables.concat(classPath, Lists.newArrayList(getBasicClasses())); unknownClass = new UnknownClassProto(this); loadedClasses.put(unknownClass.getType(), unknownClass);