java generator: object flags produce uncompilable code
评估
调研方向
阅读 internal/generators/java/java.tmpl 和 internal/generators/java/java.go 中 ToMapLiteral 的实现;issue 指出了出错的模板调用和生成的 Java 代码。检查其他 Java 生成器类型如何处理导入、返回类型和对象默认值。完成标准是:生成的对象访问器使用 Value 默认值和返回类型,包含所需的导入,并能通过 SDK 编译。
由索引模型根据 Issue 内容生成。
描述
Version: openfeature CLI 0.4.1 (openfeature generate java); the templates on main (7f79478) are unchanged.
Manifest:
{"flags":{"retry_policy":{"flagType":"object","defaultValue":{"backoff_seconds":2,"max_attempts":3}}}}
Generated:
public Object retryPolicy(EvaluationContext ctx) {
return client.getObjectValue("retry_policy", Map.of("backoff_seconds", 2, "max_attempts", 3), ctx);
}
Problems
java.util.Mapis not imported (internal/generators/java/java.tmpllines 4-7 only import the OpenFeature SDK types), sojavacfails withcannot find symbol: variable Map.- Even with the import,
Client.getObjectValue(String, Value, EvaluationContext)takes adev.openfeature.sdk.Value, not aMap. The template (lines 59 and 64) passes theToMapLiteraloutput fromjava.go(toMapLiteral, line 59-68, which writesMap.of() directly. The accessors also returnObjectinstead ofValue.
Expected: an import plus a Value-typed default (e.g. Value.objectToValue(Map.of(...))) and Value return types.
Related: #248 (typesafe object flags).
- 主要语言
- Go
- 星标
- 67
- 派生
- 25
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
open-feature/cli 的其他 Issue
-
Add mise as a recommended installation method可能已有人在做 @reidsm 于 41 天前认领。 未关闭
难度 1/5 1-3 小时 新手友好度 70/100
open-feature/cli#239 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 50/100
open-feature/cli#298 ·
-
难度 5/5 一周以上 新手友好度 35/100
open-feature/cli#247 ·
-
难度 2/5 1-3 小时 新手友好度 45/100
open-feature/cli#229 · 3 条评论 ·
-
难度 5/5 一周以上 新手友好度 35/100
open-feature/cli#210 · 1 条评论 ·
相似的 Issue
-
enhancement good first issue help wanted
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
-
go good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
Azure/prometheus-collector#1828 · 1 条评论 ·
维护者通常 2 天内回复