-
Notifications
You must be signed in to change notification settings - Fork 541
Closed
Labels
Milestone
Description
问题描述
#2578 , 1.x 支持但fastjson 2.0.51兼容有问题。
环境信息
- OS信息: [MacOS 12.7.4 M1 Pro 16 GB]
- JDK信息: [Openjdk 17.0.6]
- 版本信息:[Fastjson 2.0.51]
重现步骤
import com.alibaba.fastjson.JSON;
import org.junit.jupiter.api.Test;
import java.awt.Color;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Issue2578 {
@Test
public void test() {
Color blue = Color.BLUE;
String colorStr = JSON.toJSONString(blue);
assertEquals("{\"r\":0,\"g\":0,\"b\":255,\"alpha\":255}", colorStr);
Color color = JSON.parseObject(colorStr, Color.class);
assertEquals(blue, color);
}
}
期待的正确结果
Expected :{"r":0,"g":0,"b":255,"alpha":255}
Actual :{"rgb":-16776961}