False error: in main, an early return on the args array makes a later state-refined call report "Variable 'args' could not be found"
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- java
- Área
- devtools, testing-qa
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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).
- Lenguaje dominante
- Java
- Estrellas
- 73
- Forks
- 38
- Merge medio
- 12 h 32 min
- PR fusionados (30 d)
- 45
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de liquid-java/liquidjava
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
liquid-java/liquidjava#562 ·
Los mantenedores suelen responder en 1 día
-
A float ghost crashes the verifier: "Ghost not implemented for type float"Posiblemente ocupada @MohammedZaid1740 la tomó hace 7 días. Abiertobug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
liquid-java/liquidjava#443 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug real-world-finding
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
liquid-java/liquidjava#395 ·
Los mantenedores suelen responder en 1 día
-
A ternary between arrays crashes: Sorts (Array Int Int) and Bool are incompatiblePosiblemente ocupada @CatarinaGamboa la tomó hace 4 días. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 15/100
liquid-java/liquidjava#558 ·
Los mantenedores suelen responder en 1 día
-
new T[a][b] gets length b instead of a (unsound)Posiblemente ocupada @CatarinaGamboa la tomó hace 4 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 30/100
liquid-java/liquidjava#557 ·
Los mantenedores suelen responder en 1 día
Todos los issues de liquid-java/liquidjava
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 60/100
quelea-projection/Quelea#749 ·
Los mantenedores suelen responder en 1 día
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
erkamyaman/rust-anything#963 ·
Los mantenedores suelen responder en 1 día
-
api-diagnostics bug jdbc
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
ClickHouse/clickhouse-java#3464 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 Medio día Aptitud para principiantes 76/100
-
Deferred
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Sanne/incus-spawn#2768 ·
Los mantenedores suelen responder en 1 día