Skip to content

Commit

Permalink
fix: clear node flags for custom decompilation mode
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Feb 6, 2024
1 parent 1bb956a commit edf6ce2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public void remove(AFlag flag) {
flags.remove(flag);
}

public void clearFlags() {
flags.clear();
}

public <T extends IJadxAttribute> void remove(IJadxAttrType<T> type) {
if (!attributes.isEmpty()) {
writeAttributes(map -> map.remove(type));
Expand Down
2 changes: 1 addition & 1 deletion jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions jadx-core/src/main/java/jadx/core/dex/nodes/FieldNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit edf6ce2

Please sign in to comment.