False error: in main, an early return on the args array makes a later state-refined call report "Variable 'args' could not be found"
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
- 領域
- devtools, testing-qa
調査の方向性
Start by reproducing the failure with the supplied ZipFileRefinements.java and Client.java examples, then compare the main case with the renamed-method and no-early-return variants. Trace how the verifier handles early returns, method parameters, and @StateRefinement calls; the payload names no repository source files or tests. Done means the reproducer verifies successfully without changing the passing variants.
索引モデルが issue の本文から書いたものです。
説明
Summary
In a method named main, an early return guarded by the array parameter's length makes a later call with a @StateRefinement fail with Not Found Error: Variable 'xs' could not be found. The same body in a method with any other name verifies.
Minimal reproducer
ZipFileRefinements.java:
import java.util.zip.ZipFile;
import liquidjava.specification.*;
@ExternalRefinementsFor("java.util.zip.ZipFile")
@StateSet({"open", "closed"})
public interface ZipFileRefinements {
@StateRefinement(to = "open(this)")
void ZipFile(String name);
@StateRefinement(from = "open(this)", to = "closed(this)")
void close();
}
Client.java:
import java.util.zip.ZipFile;
public class Client {
public static void main(String[] xs) throws java.io.IOException {
if (xs.length < 1) {
return;
}
ZipFile z = new ZipFile("a.zip");
z.close(); // Not Found Error: Variable 'xs' could not be found
}
}
Expected: Correct! Passed Verification.
What changes the result (all with the spec above):
| variant | result |
|---|---|
| as above | Variable 'xs' could not be found at z.close() |
static void main(String[] xs) (not public) |
same error |
renamed to public static void f(String[] xs) |
passes |
no early return (if (...) System.out.println(...)) |
passes |
the return branch removed, or z.close() removed |
passes |
| no spec | passes |
Seen on 1a506fe, f7f366c and main at 19991d3.
Why it matters: real code
A command-line unzip tool (plasma-umass/doppio, classes/util/Unzip.java, MIT):
public static void main(String[] args) {
if (args.length < 1) {
System.err.println("Usage: Unzip zipfile prefix");
return;
}
...
ZipFile zipFile = new ZipFile(args[0]);
...
zipFile.close();
Checking a usage message and returning at the top of main is common in CLI tools, so any spec'd class used afterwards in main hits this.
Found while checking mined client code against JDK specs (liquid-java/co-specification, verifier probe V33).
- 主要言語
- Java
- スター
- 73
- フォーク
- 38
- 平均マージ
- 12時間 32分
- マージ済み PR(30日)
- 45
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 日以内に返信
-
bug real-world-finding
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
liquid-java/liquidjava#395 ·
メンテナーはふだん 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 日以内に返信
liquid-java/liquidjava の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
quelea-projection/Quelea#749 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
erkamyaman/rust-anything#963 ·
メンテナーはふだん 1 日以内に返信
-
api-diagnostics bug jdbc
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
ClickHouse/clickhouse-java#3464 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 76/100
-
Deferred
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Sanne/incus-spawn#2768 ·
メンテナーはふだん 1 日以内に返信