diff --git a/jadx-core/src/main/java/jadx/core/dex/attributes/AttrNode.java b/jadx-core/src/main/java/jadx/core/dex/attributes/AttrNode.java index bbc99696524..e5964179c02 100644 --- a/jadx-core/src/main/java/jadx/core/dex/attributes/AttrNode.java +++ b/jadx-core/src/main/java/jadx/core/dex/attributes/AttrNode.java @@ -139,14 +139,12 @@ public void clearAttributes() { storage = EMPTY_ATTR_STORAGE; } - /** - * Remove all attribute - */ public void unloadAttributes() { if (storage == EMPTY_ATTR_STORAGE) { return; } storage.unloadAttributes(); + storage.clearFlags(); unloadIfEmpty(); } diff --git a/jadx-core/src/main/java/jadx/core/dex/attributes/AttributeStorage.java b/jadx-core/src/main/java/jadx/core/dex/attributes/AttributeStorage.java index 2b476ecf36b..a3bbb860e94 100644 --- a/jadx-core/src/main/java/jadx/core/dex/attributes/AttributeStorage.java +++ b/jadx-core/src/main/java/jadx/core/dex/attributes/AttributeStorage.java @@ -102,6 +102,10 @@ public void remove(AFlag flag) { flags.remove(flag); } + public void clearFlags() { + flags.clear(); + } + public void remove(IJadxAttrType type) { if (!attributes.isEmpty()) { writeAttributes(map -> map.remove(type)); diff --git a/jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java b/jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java index a0aff4b5ff2..5aab2eef923 100644 --- a/jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java +++ b/jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java @@ -432,7 +432,7 @@ public void unload() { } methods.forEach(MethodNode::unload); innerClasses.forEach(ClassNode::unload); - fields.forEach(FieldNode::unloadAttributes); + fields.forEach(FieldNode::unload); unloadAttributes(); setState(NOT_LOADED); this.loadStage = LoadStage.NONE; diff --git a/jadx-core/src/main/java/jadx/core/dex/nodes/FieldNode.java b/jadx-core/src/main/java/jadx/core/dex/nodes/FieldNode.java index b4a5a244f38..b73392ccdd3 100644 --- a/jadx-core/src/main/java/jadx/core/dex/nodes/FieldNode.java +++ b/jadx-core/src/main/java/jadx/core/dex/nodes/FieldNode.java @@ -38,6 +38,10 @@ public FieldNode(ClassNode cls, FieldInfo fieldInfo, int accessFlags) { this.accFlags = new AccessInfo(accessFlags, AFType.FIELD); } + public void unload() { + unloadAttributes(); + } + public void updateType(ArgType type) { this.type = type; }