alibaba / alibaba/AndFix

apkpatch工具类diff 方法 新增类 执行不到的问题,见注释

Open
#345 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
7k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

com.euler.patch.diff 包下DexDiffer类。

```
public DiffInfo diff(File newFile, File oldFile)
throws IOException
{
DexBackedDexFile newDexFile = DexFileFactory.loadDexFile(newFile, 19,
true);
DexBackedDexFile oldDexFile = DexFileFactory.loadDexFile(oldFile, 19,
true);
DiffInfo info = DiffInfo.getInstance();
//此行代码是否应该放入第一个for循环中,每次遍历都重置一下状态
boolean contains = false;
for (DexBackedClassDef newClazz : newDexFile.getClasses()) {
Set oldclasses = oldDexFile
.getClasses();
for (DexBackedClassDef oldClazz : oldclasses) {
if (newClazz.equals(oldClazz)) {
compareField(newClazz, oldClazz, info);
compareMethod(newClazz, oldClazz, info);
contains = true;
break;
}
}
//1、场景是现在类有修改、并且有新增类
if (contains)
continue;
//即使有新增类这里也不会被执行到。
info.addAddedClasses(newClazz);
}

return info;
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in com.euler.patch.diff.DexDiffer at diff(File newFile, File oldFile), then trace the contains flag and the calls to compareField, compareMethod, and addAddedClasses. Reproduce the stated case where a modified class and a newly added class coexist; done means both the modified-class comparison and new-class recording occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.