mirror of
https://github.com/alibaba/fastjson.git
synced 2026-10-21 16:56:28 +08:00
bug for long type builder setter
This commit is contained in:
@@ -724,7 +724,10 @@ public class ASMDeserializerFactory implements Opcodes {
|
||||
mw.visitVarInsn(ALOAD, context.var("instance"));
|
||||
mw.visitVarInsn(LLOAD, context.var(fieldInfo.getName() + "_asm", 2));
|
||||
if (fieldInfo.getMethod() != null) {
|
||||
mw.visitMethodInsn(INVOKEVIRTUAL, getType(context.getClazz()), fieldInfo.getMethod().getName(), "(J)V");
|
||||
mw.visitMethodInsn(INVOKEVIRTUAL, getType(context.getClazz()), fieldInfo.getMethod().getName(), getDesc(fieldInfo.getMethod()));
|
||||
if (!fieldInfo.getMethod().getReturnType().equals(Void.TYPE)) {
|
||||
mw.visitInsn(POP);
|
||||
}
|
||||
} else {
|
||||
mw.visitFieldInsn(PUTFIELD, getType(fieldInfo.getDeclaringClass()), fieldInfo.getField().getName(),
|
||||
getDesc(fieldInfo.getFieldClass()));
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.alibaba.json.bvt.bug;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class Bug_for_builder extends TestCase {
|
||||
|
||||
public void test_for_longBuilderMethod() throws Exception {
|
||||
VO vo = JSON.parseObject("{\"id\":123}", VO.class);
|
||||
}
|
||||
|
||||
public static class VO {
|
||||
|
||||
private long id;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public VO setId(long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user