Verifier crashes on a `for` loop whose body is an empty statement (`for (...) ;`)
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
崩潰發生在 src/main/java/liquidjava/processor/refinement_checker/RefinementTypeChecker.java 中的 visitCtFor,其中一個 lambda 在大約第 628 行對 CtFor.getBody() 呼叫了 getElements;同一路徑在大約第 658 行經過 visitLoop。先閱讀那裡如何處理迴圈主體,然後執行 issue 中的重現範例,它的迴圈主體為空 ;。當該重現範例輸出 Correct! Passed Verification.,且現有的迴圈測試仍然通過時,即完成。
由索引模型根據 Issue 內容生成。
描述
Impact: verification stops with an internal error on any for loop whose body is an empty statement (;).
Description
for (...; ...; ...) ; has no body block: CtFor.getBody() is null, and RefinementTypeChecker.visitCtFor calls getElements on it (RefinementTypeChecker.java:628). Nothing in the loop needs a refinement, so an empty body could be checked as an empty block.
Minimal reproducer
public class Repro {
static int total(int[] counts) {
int total = 0;
for (int i = 0; i < counts.length; total += counts[i], i++)
;
return total;
}
}
Expected
Correct! Passed Verification.
Actual
Exception in thread "main" java.lang.RuntimeException:
Error while checking CtMethodImpl
on total(int[] counts) {
at Repro.java:2
with
Error while checking CtBlockImpl
on {
at Repro.java:2
with
Error while checking CtForImpl
on for (int i = 0; i < counts.length; total += counts[i], i++)
at Repro.java:4
with Cannot invoke "spoon.reflect.code.CtStatement.getElements(spoon.reflect.visitor.Filter)" because the return value of "spoon.reflect.code.CtFor.getBody()" is null
...
Caused by: java.lang.NullPointerException: Cannot invoke "spoon.reflect.code.CtStatement.getElements(spoon.reflect.visitor.Filter)" because the return value of "spoon.reflect.code.CtFor.getBody()" is null
at liquidjava.processor.refinement_checker.RefinementTypeChecker.lambda$visitCtFor$4(RefinementTypeChecker.java:628)
at liquidjava.processor.refinement_checker.RefinementTypeChecker.visitLoop(RefinementTypeChecker.java:658)
at liquidjava.processor.refinement_checker.RefinementTypeChecker.visitCtFor(RefinementTypeChecker.java:623)
Reproduced on main at ad055b49 (liquidjava-verifier 0.0.35).
Real-world file that hits it
for (int i = 0; i < updateCount.length; cnt += updateCount[i], i++) ;— tejeswarp/tungsten-replicator (file)
Context
Found while running LiquidJava on the original repository files of 53 real-world typestate and refinement bugs (the files our study exercises were simplified from). Each file is verified on its own, as a user would verify one file of a project, so the project's other classes and its dependencies are not on the classpath.
- 主要語言
- Java
- 星號
- 73
- 分支
- 38
- 平均合併
- 12 小時 32 分鐘
- 30 天內合併 PR
- 45
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
liquid-java/liquidjava 的其他 Issue
-
難度 1/5 1 小時以內 新手友好度 90/100
liquid-java/liquidjava#562 ·
維護者通常 1 天內回覆
-
A float ghost crashes the verifier: "Ghost not implemented for type float"可能已有人在做 @MohammedZaid1740 於 7 天前認領。 未關閉bug good first issue
難度 2/5 1-3 小時 新手友好度 72/100
liquid-java/liquidjava#443 · 1 則留言 ·
維護者通常 1 天內回覆
-
A ternary between arrays crashes: Sorts (Array Int Int) and Bool are incompatible可能已有人在做 @CatarinaGamboa 於 4 天前認領。 未關閉bug
難度 4/5 3-5 天 新手友好度 15/100
liquid-java/liquidjava#558 ·
維護者通常 1 天內回覆
-
new T[a][b] gets length b instead of a (unsound)可能已有人在做 @CatarinaGamboa 於 4 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 30/100
liquid-java/liquidjava#557 ·
維護者通常 1 天內回覆
-
Invariant inference: mark inferred facts in diagnostics, and a hint to state a loop invariant可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉enhancement error messages
難度 4/5 3-5 天 新手友好度 35/100
liquid-java/liquidjava#554 ·
維護者通常 1 天內回覆
查看 liquid-java/liquidjava 的全部 Issue
相似的 Issue
-
Identify Apache Seata as incubating in the GitHub repository description可能已有人在做 @slievrly 今天認領。 未關閉
難度 1/5 1 小時以內 新手友好度 92/100
apache/incubator-seata#8404 ·
維護者通常 1 天內回覆
-
Track FLINK-41442: on Flink 2.1+ an unaligned checkpoint can lose a split assigned just before it未關閉area:docs bug module:bigtable module:spanner priority:P3 status:blocked-upstream
難度 2/5 1-3 小時 新手友好度 72/100
flink-gcp/flink-connector-gcp#2411 ·
維護者通常 1 天內回覆
-
[BUG] Nightly Build JDK 17: latest-frameworks job red since 2026-11-28 — quarkiverse-langchain4j 2.0.0 pins Quarkus 4.0.0, which requires Java 21可能已有人在做 @uhhgxg 今天認領。 未關閉
難度 1/5 1 小時以內 新手友好度 95/100
langchain4j/langchain4j#7344 ·
維護者通常 1 天內回覆
-
documentation good first issue
難度 2/5 1-3 小時 新手友好度 75/100
cristianEncarnacion/ferroreport#149 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
QuicksilverMC/Argentum#85 ·
維護者通常 1 天內回覆