False error: in main, an early return on the args array makes a later state-refined call report "Variable 'args' could not be found"
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- devtools, testing-qa
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- Java
- Stelle
- 73
- Fork
- 38
- Merge medio
- 12h 32m
- PR unite (30g)
- 45
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di liquid-java/liquidjava
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
liquid-java/liquidjava#562 ·
I maintainer di solito rispondono entro 1 giorno
-
A float ghost crashes the verifier: "Ghost not implemented for type float"Forse già presa @MohammedZaid1740 l’ha presa 7 giorni fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
liquid-java/liquidjava#443 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug real-world-finding
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
liquid-java/liquidjava#395 ·
I maintainer di solito rispondono entro 1 giorno
-
A ternary between arrays crashes: Sorts (Array Int Int) and Bool are incompatibleForse già presa @CatarinaGamboa l’ha presa 4 giorni fa. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
liquid-java/liquidjava#558 ·
I maintainer di solito rispondono entro 1 giorno
-
new T[a][b] gets length b instead of a (unsound)Forse già presa @CatarinaGamboa l’ha presa 4 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 30/100
liquid-java/liquidjava#557 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di liquid-java/liquidjava
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
quelea-projection/Quelea#749 ·
I maintainer di solito rispondono entro 1 giorno
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
erkamyaman/rust-anything#963 ·
I maintainer di solito rispondono entro 1 giorno
-
api-diagnostics bug jdbc
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
ClickHouse/clickhouse-java#3464 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 76/100
-
Deferred
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Sanne/incus-spawn#2768 ·
I maintainer di solito rispondono entro 1 giorno