提交 5e62b907 编写于 作者: S Skylot

fix: resolve ClassCastException on encoded value access (#946)

上级 6192ced2
......@@ -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());
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册