ImmutableContext and ImmutableStructure truncate Instant values to milliseconds
维护者通常 1 天内回复
评估
调研方向
先阅读 Value.clone(),以及 issue 中描述的 ImmutableStructure 构造和读取路径。检查 ImmutableStructureTest.MutatingGetInstantValueShouldNotChangeOriginalValue,它目前会将输入截断到毫秒精度。若具有亚毫秒精度的 instant 通过 getValue(key).asInstant()、asMap() 和 asObjectMap() 返回时保持不变,则表示完成。
由索引模型根据 Issue 内容生成。
描述
An Instant stored in an ImmutableStructure or ImmutableContext loses its sub-millisecond precision. getValue(key).asInstant(), asMap() and asObjectMap() return an instant truncated to milliseconds, so the value read back is not equal to the value stored.
Value.clone() copies instants with Instant.ofEpochMilli(instant.toEpochMilli()), and ImmutableStructure clones every value on construction and on each read.
Expected behavior
The stored Instant is returned unchanged. Instant is immutable, so a copy is not needed.
Steps to reproduce
Instant instant = Instant.ofEpochSecond(1_700_000_000L, 123_456_789L);
EvaluationContext ctx = new ImmutableContext(Map.of("t", new Value(instant)));
System.out.println(instant); // 2023-11-14T22:13:20.123456789Z
System.out.println(ctx.getValue("t").asInstant()); // 2023-11-14T22:13:20.123Z
Instant.now() has microsecond or finer resolution on Java 9 and later, so contexts built from Instant.now() are affected in practice. The existing ImmutableStructureTest.MutatingGetInstantValueShouldNotChangeOriginalValue test calls truncatedTo(ChronoUnit.MILLIS) to avoid this.
- 主要语言
- Java
- 星标
- 129
- 派生
- 62
- 平均合并
- 6 小时 37 分钟
- 30 天内合并 PR
- 12
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
open-feature/java-sdk 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
open-feature/java-sdk#2019 · 2 条评论 ·
维护者通常 1 天内回复
-
perf: avoid creating exceptions when no hook implements the error stage可能已有人在做 @toddbaert 于 29 天前认领。 未关闭enhancement
open-feature/java-sdk#2056 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
open-feature/java-sdk#2053 ·
维护者通常 1 天内回复
-
v0.9.0
难度 5/5 一周以上 新手友好度 35/100
open-feature/java-sdk#1999 ·
维护者通常 1 天内回复
-
on setProvider call, shutting down the previous provider should happen before creating the new one未关闭
难度 3/5 1-2 天 新手友好度 50/100
open-feature/java-sdk#1934 · 1 个 reaction ·
维护者通常 1 天内回复
查看 open-feature/java-sdk 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 80/100
googleads/googleads-mobile-flutter#1541 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
Julow/Unexpected-Keyboard#1490 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
Vakore/ZappierGames#275 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
unitycatalog/unitycatalog#2148 ·
维护者通常 2 天内回复
-
enhancement priority: low
难度 1/5 1 小时以内 新手友好度 92/100
Riptide-Labs/riptide#1060 ·
维护者通常 1 天内回复