fix: don't unload attributes added to class at initial load (#1010)
This commit is contained in:
@@ -92,6 +92,8 @@ public class AType<T extends IAttribute> {
|
||||
public static final AType<RegDebugInfoAttr> REG_DEBUG_INFO = new AType<>();
|
||||
|
||||
public static final Set<AType<?>> SKIP_ON_UNLOAD = new HashSet<>(Arrays.asList(
|
||||
SOURCE_FILE,
|
||||
FIELD_INIT,
|
||||
FIELD_REPLACE,
|
||||
METHOD_INLINE,
|
||||
SKIP_MTH_ARGS));
|
||||
|
||||
@@ -167,16 +167,20 @@ public class ClassNode extends NotificationAttrNode implements ILoadable, ICodeN
|
||||
f.addAttr(FieldInitAttr.NULL_VALUE);
|
||||
}
|
||||
}
|
||||
List<EncodedValue> values = cls.getStaticFieldInitValues();
|
||||
int count = values.size();
|
||||
if (count == 0 || count > staticFields.size()) {
|
||||
return;
|
||||
try {
|
||||
List<EncodedValue> values = cls.getStaticFieldInitValues();
|
||||
int count = values.size();
|
||||
if (count == 0 || count > staticFields.size()) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < count; i++) {
|
||||
staticFields.get(i).addAttr(FieldInitAttr.constValue(values.get(i)));
|
||||
}
|
||||
// process const fields
|
||||
root().getConstValues().processConstFields(this, staticFields);
|
||||
} catch (Exception e) {
|
||||
this.addWarnComment("Failed to load initial values for static fields", e);
|
||||
}
|
||||
for (int i = 0; i < count; i++) {
|
||||
staticFields.get(i).addAttr(FieldInitAttr.constValue(values.get(i)));
|
||||
}
|
||||
// process const fields
|
||||
root().getConstValues().processConstFields(this, staticFields);
|
||||
}
|
||||
|
||||
private void addSourceFilenameAttr(String fileName) {
|
||||
|
||||
Reference in New Issue
Block a user