use of com.tencent.tinker.build.util.DexClassesComparator.DexClassInfo in project tinker by Tencent.
the class DexDiffDecoder method checkDexChange.
private void checkDexChange(Dex originDex, Dex newDex) {
DexClassesComparator classesCmptor = new DexClassesComparator("*");
classesCmptor.setIgnoredRemovedClassDescPattern(config.mDexLoaderPattern);
classesCmptor.startCheck(originDex, newDex);
List<DexClassInfo> addedClassInfos = classesCmptor.getAddedClassInfos();
boolean isNoClassesAdded = addedClassInfos.isEmpty();
Map<String, DexClassInfo[]> changedClassDescToClassInfosMap;
boolean isNoClassesChanged;
if (isNoClassesAdded) {
changedClassDescToClassInfosMap = classesCmptor.getChangedClassDescToInfosMap();
isNoClassesChanged = changedClassDescToClassInfosMap.isEmpty();
} else {
throw new TinkerPatchException("some classes was unexpectedly added in patched new dex, check if there's any bugs in " + "patch algorithm. Related classes: " + Utils.collectionToString(addedClassInfos));
}
if (isNoClassesChanged) {
List<DexClassInfo> deletedClassInfos = classesCmptor.getDeletedClassInfos();
if (!deletedClassInfos.isEmpty()) {
throw new TinkerPatchException("some classes that are not matched to loader class pattern " + "was unexpectedly deleted in patched new dex, check if there's any bugs in " + "patch algorithm. Related classes: " + Utils.collectionToString(deletedClassInfos));
}
} else {
throw new TinkerPatchException("some classes was unexpectedly changed in patched new dex, check if there's any bugs in " + "patch algorithm. Related classes: " + Utils.collectionToString(changedClassDescToClassInfosMap.keySet()));
}
}
Aggregations