Fix for broken tests.

This commit is contained in:
Izzat Bahadirov 2013-04-29 17:02:14 -04:00
parent 6a2a627d3b
commit 0f61ce9a6f

View File

@ -62,20 +62,21 @@ public class ClassPath {
* *
* @param classPath An array of DexFile objects. When loading a class, these dex files will be searched in order * @param classPath An array of DexFile objects. When loading a class, these dex files will be searched in order
*/ */
public ClassPath(int api, DexFile... classPath) throws IOException { public ClassPath(DexFile... classPath) throws IOException {
this(api, classPath, true); this(classPath, true, 15);
} }
/** /**
* Creates a new ClassPath instance that can load classes from the given dex files * Creates a new ClassPath instance that can load classes from the given dex files
* *
* @param classPath An iterable of DexFile objects. When loading a class, these dex files will be searched in order * @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(int api, Iterable<DexFile> classPath) { public ClassPath(Iterable<DexFile> classPath, int api) {
this(api, Iterables.toArray(classPath, DexFile.class), false); this(Iterables.toArray(classPath, DexFile.class), false, api);
} }
private ClassPath(int api, @Nonnull DexFile[] classPath, boolean copyArray) { private ClassPath(@Nonnull DexFile[] classPath, boolean copyArray, int api) {
if (copyArray) { if (copyArray) {
dexFiles = new DexFile[classPath.length+1]; dexFiles = new DexFile[classPath.length+1];
System.arraycopy(classPath, 0, dexFiles, 0, classPath.length); System.arraycopy(classPath, 0, dexFiles, 0, classPath.length);
@ -165,7 +166,7 @@ public class ClassPath {
dexFiles.add(loadClassPathEntry(classPathDirs, classPathEntry, api)); dexFiles.add(loadClassPathEntry(classPathDirs, classPathEntry, api));
} }
dexFiles.add(dexFile); dexFiles.add(dexFile);
return new ClassPath(api, dexFiles); return new ClassPath(dexFiles, api);
} }
private static final Pattern dalvikCacheOdexPattern = Pattern.compile("@([^@]+)@classes.dex$"); private static final Pattern dalvikCacheOdexPattern = Pattern.compile("@([^@]+)@classes.dex$");