optimizely / optimizely/java-sdk

[BUG] Gson deserialization treats integers as doubles, breaking downstream serializers

未关闭
#622 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

acknowledged bug
主要语言
Java
星标
44
派生
32
平均合并
8 小时 39 分钟
30 天内合并 PR
1

描述

Is there an existing issue for this?
  • I have searched the existing issues
SDK Version

4.4.0

Current Behavior

When using JSON variables with GsonConfigParser, integers within JSON variables appear as doubles to outside consumers. The Map output then can't be returned to valid JSON for use with downstream JSON parsing tools, like kotlinx.serialization.

Expected Behavior

Integer-looking JSON values are deserialized to longs, while decimal-looking JSON values are deserialized to doubles.

Steps To Reproduce

See associated pull request.

Java Version

21

Link

No response

Logs

No response

Severity

Minor issue

Workaround/Solution

Re-interpret doubles as integers where needed.

Recent Change

No response

Conflicts

No response

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 SDK 版本 4.4.0 的入口点 GsonConfigParser 开始,使用 Java 21 复现 issue 中描述的 JSON 变量行为。比较结果 Map 中看起来像整数的值和看起来像小数的值;完成标准是整数表示为 longs、小数表示为 doubles,同时不破坏下游 JSON 序列化。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。