False error: in main, an early return on the args array makes a later state-refined call report "Variable 'args' could not be found"
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- java
- Domaine
- devtools, testing-qa
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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).
- Langage dominant
- Java
- Étoiles
- 73
- Forks
- 38
- Merge moyen
- 12 h 32 min
- PR mergées (30 j)
- 45
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de liquid-java/liquidjava
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
liquid-java/liquidjava#562 ·
Les mainteneurs répondent en général sous 1 jour
-
A float ghost crashes the verifier: "Ghost not implemented for type float"Peut-être pris @MohammedZaid1740 l’a pris il y a 7 jours. Ouvertebug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
liquid-java/liquidjava#443 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug real-world-finding
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
liquid-java/liquidjava#395 ·
Les mainteneurs répondent en général sous 1 jour
-
A ternary between arrays crashes: Sorts (Array Int Int) and Bool are incompatiblePeut-être pris @CatarinaGamboa l’a pris il y a 4 jours. Ouvertebug
Difficulté 4/5 3-5 jours Accessibilité débutants 15/100
liquid-java/liquidjava#558 ·
Les mainteneurs répondent en général sous 1 jour
-
new T[a][b] gets length b instead of a (unsound)Peut-être pris @CatarinaGamboa l’a pris il y a 4 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 30/100
liquid-java/liquidjava#557 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de liquid-java/liquidjava
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 60/100
quelea-projection/Quelea#749 ·
Les mainteneurs répondent en général sous 1 jour
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 92/100
erkamyaman/rust-anything#963 ·
Les mainteneurs répondent en général sous 1 jour
-
api-diagnostics bug jdbc
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
ClickHouse/clickhouse-java#3464 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 Une demi-journée Accessibilité débutants 76/100
-
Deferred
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Sanne/incus-spawn#2768 ·
Les mainteneurs répondent en général sous 1 jour