Remove DexIO.getDexPoolOverflow

This commit is contained in:
Lanchon 2018-09-13 06:41:32 -03:00
parent adc133ceac
commit 341f706f93

View File

@ -55,7 +55,7 @@ public class DexIO {
while (classIterator.hasNext()) { while (classIterator.hasNext()) {
ClassDef classDef = classIterator.next(); ClassDef classDef = classIterator.next();
dexPool.internClass(classDef); dexPool.internClass(classDef);
if (getDexPoolOverflow(dexPool, maxDexPoolSize)) { if (dexPool.hasOverflowed(maxDexPoolSize)) {
handleDexPoolOverflow(classDef, classCount, classes.size()); handleDexPoolOverflow(classDef, classCount, classes.size());
throw new AssertionError("unexpected type count"); throw new AssertionError("unexpected type count");
} }
@ -139,7 +139,7 @@ public class DexIO {
ClassDef classDef = classIterator.peek(); ClassDef classDef = classIterator.peek();
dexPool.mark(); dexPool.mark();
dexPool.internClass(classDef); dexPool.internClass(classDef);
if (getDexPoolOverflow(dexPool, maxDexPoolSize)) { if (dexPool.hasOverflowed(maxDexPoolSize)) {
handleDexPoolOverflow(classDef, fileClassCount, minMainDexClassCount); handleDexPoolOverflow(classDef, fileClassCount, minMainDexClassCount);
dexPool.reset(); dexPool.reset();
break; break;
@ -160,10 +160,6 @@ public class DexIO {
} while (classIterator.hasNext()); } while (classIterator.hasNext());
} }
private static boolean getDexPoolOverflow(DexPool dexPool, int maxDexPoolSize) {
return dexPool.hasOverflowed(maxDexPoolSize);
}
private static void handleDexPoolOverflow(ClassDef classDef, int classCount, int minClassCount) { private static void handleDexPoolOverflow(ClassDef classDef, int classCount, int minClassCount) {
if (classCount < minClassCount) throw new DexPoolOverflowException( if (classCount < minClassCount) throw new DexPoolOverflowException(
"Dex pool overflowed while writing type " + (classCount + 1) + " of " + minClassCount); "Dex pool overflowed while writing type " + (classCount + 1) + " of " + minClassCount);