fix: clear node flags for custom decompilation mode

This commit is contained in:
Skylot
2024-02-06 18:17:13 +00:00
parent 1bb956a8b0
commit edf6ce273c
4 changed files with 10 additions and 4 deletions
@@ -139,14 +139,12 @@ public abstract class AttrNode implements IAttributeNode {
storage = EMPTY_ATTR_STORAGE;
}
/**
* Remove all attribute
*/
public void unloadAttributes() {
if (storage == EMPTY_ATTR_STORAGE) {
return;
}
storage.unloadAttributes();
storage.clearFlags();
unloadIfEmpty();
}
@@ -102,6 +102,10 @@ public class AttributeStorage {
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));
@@ -432,7 +432,7 @@ public class ClassNode extends NotificationAttrNode
}
methods.forEach(MethodNode::unload);
innerClasses.forEach(ClassNode::unload);
fields.forEach(FieldNode::unloadAttributes);
fields.forEach(FieldNode::unload);
unloadAttributes();
setState(NOT_LOADED);
this.loadStage = LoadStage.NONE;
@@ -38,6 +38,10 @@ public class FieldNode extends NotificationAttrNode implements ICodeNode {
this.accFlags = new AccessInfo(accessFlags, AFType.FIELD);
}
public void unload() {
unloadAttributes();
}
public void updateType(ArgType type) {
this.type = type;
}