fix: resolve ClassCastException on encoded value access (#946)
This commit is contained in:
@@ -287,9 +287,9 @@ public class RegionGen extends InsnGen {
|
||||
staticField(code, fn.getFieldInfo());
|
||||
// print original value, sometimes replaced with incorrect field
|
||||
FieldInitAttr valueAttr = fn.get(AType.FIELD_INIT);
|
||||
if (valueAttr != null) {
|
||||
if (valueAttr != null && valueAttr.getValueType() == FieldInitAttr.InitType.CONST) {
|
||||
Object value = valueAttr.getEncodedValue();
|
||||
if (value != null && valueAttr.getValueType() == FieldInitAttr.InitType.CONST) {
|
||||
if (value != null) {
|
||||
code.add(" /*").add(value.toString()).add("*/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,9 +72,9 @@ public class ConstStorage {
|
||||
if (accFlags.isStatic() && accFlags.isFinal()) {
|
||||
FieldInitAttr fv = f.get(AType.FIELD_INIT);
|
||||
if (fv != null
|
||||
&& fv.getEncodedValue() != null
|
||||
&& fv.getValueType() == FieldInitAttr.InitType.CONST
|
||||
&& fv != FieldInitAttr.NULL_VALUE) {
|
||||
&& fv != FieldInitAttr.NULL_VALUE
|
||||
&& fv.getEncodedValue() != null) {
|
||||
addConstField(cls, f, fv.getEncodedValue().getValue(), accFlags.isPublic());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user