You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "firmianaQ (via GitHub)" <gi...@apache.org> on 2025/05/28 08:53:05 UTC
[I] 序列化报错 [dubbo-hessian-lite]
firmianaQ opened a new issue, #81:
URL: https://github.com/apache/dubbo-hessian-lite/issues/81
hessian-lite版本:4.0.3
jdk: 17
```
public enum Gender {
MALE, FEMALE
}
public record TestObj(List<InnerObj> list) implements Serializable {
@Serial
private static final long serialVersionUID = -6780365630900672593L;
public static class InnerObj implements Serializable {
@Serial
private static final long serialVersionUID = 539682147868492463L;
private String str;
private Gender gender;
public InnerObj() {
}
public String getStr() {
return this.str;
}
public Gender getGender() {
return this.gender;
}
public InnerObj setStr(String str) {
this.str = str;
return this;
}
public InnerObj setGender(Gender gender) {
this.gender = gender;
return this;
}
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof InnerObj)) return false;
final InnerObj other = (InnerObj) o;
if (!other.canEqual((Object) this)) return false;
final Object this$str = this.getStr();
final Object other$str = other.getStr();
if (this$str == null ? other$str != null : !this$str.equals(other$str)) return false;
final Object this$gender = this.getGender();
final Object other$gender = other.getGender();
if (this$gender == null ? other$gender != null : !this$gender.equals(other$gender)) return false;
return true;
}
protected boolean canEqual(final Object other) {
return other instanceof InnerObj;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $str = this.getStr();
result = result * PRIME + ($str == null ? 43 : $str.hashCode());
final Object $gender = this.getGender();
result = result * PRIME + ($gender == null ? 43 : $gender.hashCode());
return result;
}
public String toString() {
return "TestObj.InnerObj(str=" + this.getStr() + ", gender=" + this.getGender() + ")";
}
}
}
@Test
public void test() throws IOException {
List<TestObj.InnerObj> list = new ArrayList<>();
list.add(new TestObj.InnerObj().setStr("1").setGender(Gender.MALE));
list.add(new TestObj.InnerObj().setStr("2").setGender(Gender.MALE));
TestObj obj = new TestObj(list);
Assertions.assertEquals(obj, baseHessian2Serialize(obj));
}
```

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [I] record Serialization Error with dubbo-hessian-lite [dubbo-hessian-lite]
Posted by "jonathenzc (via GitHub)" <gi...@apache.org>.
jonathenzc commented on issue #81:
URL: https://github.com/apache/dubbo-hessian-lite/issues/81#issuecomment-4508560725
是的,关掉unsafe能恢复。我也遇到了List对象,对象持有enum时,第二个元素开始都错乱了
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [I] record Serialization Error with dubbo-hessian-lite [dubbo-hessian-lite]
Posted by "firmianaQ (via GitHub)" <gi...@apache.org>.
firmianaQ commented on issue #81:
URL: https://github.com/apache/dubbo-hessian-lite/issues/81#issuecomment-3284317798
好像是枚举的问题?一个List<XxModel> ,XxModel内有个枚举,第二个元素的枚举就会变成XxModel对象。。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org