RuntimeException: Create sequential serializer failed
galaxyxym opened this issue · comments
galaxyxym commented
Search before asking
- I had searched in the issues and found no similar issues.
Version
fury: 0.6.0.SNAPSHOT
os: linux
jdk: openjdk8
fastjson: 1.2.70
Component(s)
Java
Minimal reproduce step
public class TestMain {
static ThreadSafeFury fury = Fury.builder().withLanguage(Language.JAVA)
.requireClassRegistration(false)
.withRefTracking(true)
.registerGuavaTypes(false)
.withCompatibleMode(CompatibleMode.COMPATIBLE)
.withScopedMetaShare(true)
.buildThreadSafeFury();
public static void main(String[] args) {
DemoResponse resp = new DemoResponse();
byte[] serialize = fury.serialize(resp);
System.out.println("size:" + serialize.length);
}
}
import com.alibaba.fastjson.JSONObject;
@Data
public class DemoResponse {
private List<JSONObject> jsonObjs;
public DemoResponse() {
}
}
What did you expect to see?
serialize successfully
What did you see instead?
RuntimeException: Create sequential serializer failed
Caused by: org.apache.fury.codegen.CodegenException: Compile error:
DemoResponseFuryRefCodec_1_1309552426_1675763772.java', Line 88, Column 13: Expression "value0" is not an rvalue
/* 0086 */ private void writeMap(MemoryBuffer memoryBuffer2, com.alibaba.fastjson.JSONObject jSONObject1) {
/* 0087 */ AbstractMapSerializer abstractMapSerializer0;
/* 0088 */ if (((value0 & 4) != 4)) {
/* 0089 */ abstractMapSerializer0 = jDKCompatibleMapSerializer;
/* 0090 */ } else {
/* 0091 */ abstractMapSerializer0 = ((AbstractMapSerializer)jSONObjectClassInfoHolder.getSerializer());
/* 0092 */ }
/* 0093 */
/* 0094 */ if (abstractMapSerializer0.supportCodegenHook()) {
/* 0095 */ java.util.Map map = abstractMapSerializer0.onMapWrite(memoryBuffer2, jSONObject1);
/* 0096 */ java.util.Set entrySet = map.entrySet();
/* 0097 */ java.util.Iterator iter = entrySet.iterator();
/* 0098 */ int i0 = 0;
/* 0099 */ while (iter.hasNext()) {
/* 0100 */ Object elemValue = iter.next();
/* 0101 */ java.util.Map.Entry entry = (java.util.Map.Entry)elemValue;
/* 0102 */ Object keyObj = entry.getKey();
/* 0103 */ String key = (String)keyObj;
/* 0104 */ if ((key == null)) {
/* 0105 */ memoryBuffer2.writeByte(((byte)-3));
/* 0106 */ } else {
/* 0107 */ memoryBuffer2.writeByte(((byte)0));
/* 0108 */ strSerializer.writeCharsStringCompressed(memoryBuffer2, key);
/* 0109 */ }
/* 0110 */ Object valueObj = entry.getValue();
/* 0111 */ if ((!refResolver.writeRefOrNull(memoryBuffer2, valueObj))) {
/* 0112 */ this.writeClassAndObject(memoryBuffer2, valueObj);
/* 0113 */ }
/* 0114 */ i0++;
/* 0115 */ }
/* 0116 */ } else {
/* 0117 */ abstractMapSerializer0.write(memoryBuffer2, jSONObject1);
/* 0118 */ }
/* 0119 */ }
Anything Else?
serialize ok when withScopedMetaShare "false",
but failed when withScopedMetaShare "true" or withMetaContextShare "true" or withMetaShare "true"
0.5.1 version also has this problem
Are you willing to submit a PR?
- I'm willing to submit a PR!
Shawn Yang commented
@galaxyxym which fastjson version are you using? could you provide your maven dependency config
galaxyxym commented
@galaxyxym which fastjson version are you using? could you provide your maven dependency config
Hi, version is com.alibaba:fastjson:1.2.70