Skip to content

Commit

Permalink
fix(gui): reset disk cache on new jadx version
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Jun 4, 2022
1 parent 49d0e76 commit 8123120
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jadx-core/src/main/java/jadx/api/JadxArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void setRootDir(File rootDir) {

public void close() {
try {
inputFiles.clear();
inputFiles = null;
if (codeCache != null) {
codeCache.close();
}
Expand Down
9 changes: 6 additions & 3 deletions jadx-core/src/main/java/jadx/core/Jadx.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,13 @@ public static List<IDexTreeVisitor> getFallbackPassesList() {
private static String version;

public static String getVersion() {
if (version != null) {
return version;
if (version == null) {
version = searchJadxVersion();
}
return version;
}

private static String searchJadxVersion() {
try {
ClassLoader classLoader = Jadx.class.getClassLoader();
if (classLoader != null) {
Expand All @@ -250,7 +254,6 @@ public static String getVersion() {
Manifest manifest = new Manifest(is);
String ver = manifest.getMainAttributes().getValue("jadx-version");
if (ver != null) {
version = ver;
return ver;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import jadx.api.ICodeCache;
import jadx.api.ICodeInfo;
import jadx.api.JadxArgs;
import jadx.core.Jadx;
import jadx.core.dex.nodes.RootNode;
import jadx.core.utils.Utils;
import jadx.core.utils.exceptions.JadxRuntimeException;
Expand Down Expand Up @@ -190,6 +191,7 @@ public void remove(String clsFullName) {

private String buildCodeVersion(JadxArgs args) {
return DATA_FORMAT_VERSION
+ ":" + Jadx.getVersion()
+ ":" + args.makeCodeArgsHash()
+ ":" + buildInputsHash(args.getInputFiles());
}
Expand Down

0 comments on commit 8123120

Please sign in to comment.