Ensure Builders are only called once and "lock" mutable builder parameters in object constructors.
@bevzzz 已经在做这个了。
开始于 2025年7月4日。
评估
这个 Issue 还没有评估数据。
描述
Builders in their current form suffer from a potential misuse where calling a builder setter after calling .build() may alter the state of a previously-create "target" object.
Consider:
var b = new CollectionConfig.Builder("CarelessCollection");
b.properties(Property.text("text_a"));
var cfg = b.build();
// Somewhere later in the code
b.properties(Property.text("text_b"));
client.collections.create(cfg);
CarelessCollection is created with 2 properties, despite what you might expect.
Here's another good illustration of this point: https://github.com/weaviate/java-client/pull/399#discussion_r2179514203
We should:
- In all constructors that accept a Builder, wrap all mutable fields (list / map) in their unmodifiable views:
Collections.unmodifiableListetc. - Check
.build()is only called once per object. Sth like this.
- 主要语言
- Java
- 星标
- 34
- 派生
- 29
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
weaviate/java-client 的其他 Issue
-
v6: ShardReplica.shardName has no @SerializedName, so the shard is always null可能已有人在做 @dudanogueira 于 25 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 90/100
weaviate/java-client#621 ·
-
v6: Shard.vectorQueueLenght is misspelled, so the vector queue length is always 0可能已有人在做 @dudanogueira 于 25 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
weaviate/java-client#619 ·
-
v6: tenant updates are not split at the server's 100-tenant limit, so activate/deactivate fails above 100可能已有人在做 @dudanogueira 于 37 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
weaviate/java-client#615 ·
-
v6: NvidiaReranker sends "baseUrl"; the module reads "baseURL"可能已有人在做 @dudanogueira 于 40 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
weaviate/java-client#607 ·
-
v6: rerank cannot be used with BM25, Hybrid or FetchObjects可能已有人在做 @dudanogueira 于 40 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
weaviate/java-client#603 ·
查看 weaviate/java-client 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
apache/skywalking#14120 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
micronaut-projects/micronaut-core#13677 ·
维护者通常 1 天内回复
-
new feature
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
apache/rocketmq-dashboard#5594 ·
维护者通常 3 天内回复