Soundness: a field of another class or object is read as this class's field with the same name
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start at OperationsChecker.getOperationRefinements and RefinementTypeChecker.visitCtFieldRead, using the supplied Limits/Repro example as the first reproducer. Trace how CtFieldRead targets are resolved for class fields, object fields, and enum constants, then verify that the reproducer reports a refinement error and that the name-clash cases no longer use the current class's field refinement.
由索引模型根据 Issue 内容生成。
描述
Description
Reading a field of another class or object (Limits.max, other.val) resolves to the current class's own field with the same name (this.max) when the current class has one. The wrong refinement is used, so real violations are accepted.
Minimal reproducer
import liquidjava.specification.Refinement;
class Limits {
static final int max = 10;
}
public class Repro {
int max = 5; // this class also has a field named max
void check() {
@Refinement("_ == 5") int k = Limits.max; // expected error: Limits.max is 10
}
}
Expected
A refinement error: Limits.max is 10, not 5.
Actual
Correct! Passed Verification.
Removing the field int max = 5; from Repro gives the expected error (k == 10 is not a subtype of k == 5), so the name clash is what hides it.
Reproduced on main at fbfb4e23.
Where
OperationsChecker.getOperationRefinements / RefinementTypeChecker.visitCtFieldRead: a CtFieldRead is named with Formats.THIS (this#<name>) regardless of its target, so any field read whose simple name matches a field of the current class picks up that field's refinement. The same shape affects enum constants (Format.JPG read as this.JPG when the class has a field JPG) and fields of other objects (other.val read as this.val).
Context
Found by the adversarial review of #319 (fix for #302). Pre-existing on main, independent of #319.
- 主要语言
- Java
- 星标
- 67
- 派生
- 36
- 平均合并
- 4 天 17 小时
- 30 天内合并 PR
- 7
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
liquid-java/liquidjava 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
liquid-java/liquidjava#321 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 68/100
liquid-java/liquidjava#323 ·
维护者通常 2 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 52/100
liquid-java/liquidjava#318 ·
维护者通常 2 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 55/100
liquid-java/liquidjava#317 ·
维护者通常 2 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 62/100
liquid-java/liquidjava#316 ·
维护者通常 2 天内回复
查看 liquid-java/liquidjava 的全部 Issue
相似的 Issue
-
0 - Backlog 1 - Ready documentation good first issue help wanted
难度 2/5 1-3 小时 新手友好度 78/100
-
cbor
难度 2/5 1-3 小时 新手友好度 84/100
FasterXML/jackson-dataformats-binary#844 ·
维护者通常 1 天内回复
-
improvement
难度 2/5 1-3 小时 新手友好度 78/100
apache/iceberg#18351 · 1 条评论 ·
维护者通常 1 天内回复
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 90/100
repowise-dev/repowise#2945 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复