False error: a known state 'a or b' is refused by a method allowed from a and from b (one @StateRefinement per state)
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
- 47/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- java
- Área
- testing-qa
Línea de trabajo
Start by running the minimal Java reproducer in the issue and inspect the verifier’s state refinement checks, especially how it handles methods with multiple from alternatives against a disjunction. Confirm the reported failure and compare it with the single-alternative workaround. Done means the verifier accepts calls allowed in each possible state while still rejecting calls from states the method does not allow.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Impact: after any branch that leaves an object in one of two states (if, try/catch, try/finally), a method that is allowed in both states is refused, if its spec lists one @StateRefinement per state. The error message itself shows that the required state holds. This hits the most common resource idioms: close() in finally, and a timed-out accept() in try/catch.
Minimal reproducer
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;
@StateSet({"open", "closed"})
class Res {
@StateRefinement(to = "open(this)")
public Res() {}
@StateRefinement(from = "open(this)", to = "closed(this)")
@StateRefinement(from = "closed(this)")
public void close() {}
}
public class Repro {
static void use(boolean early) {
Res r = new Res();
if (early) r.close();
r.close(); // r is open or closed here; close() is allowed in both
}
}
Expected: Correct! Passed Verification.
Actual (main @ f7f366c, and 1a506fe):
State Refinement Error: found early ? closed(r) : open(r) but expected open(r) || closed(r)
early ? closed(r) : open(r) implies open(r) || closed(r). It looks as if each from= alternative is checked on its own against the disjunction, and neither alone is implied.
Workaround (and a hint at the fix). Writing the same method as one from-less alternative, @StateRefinement(to = "closed(this)"), verifies. We now generate idempotent close() that way. But it only works when the method is allowed in every state. ServerSocket's accept() is allowed from bound and from accepted but not from unbound, and the same problem comes back with no workaround.
Real-world scenarios
-
close()on the normal path and again infinally(java.io.BufferedReader, whereclose()is idempotent), withclose()specified per state:BufferedReader r = new BufferedReader(new StringReader("a\nb")); try { r.readLine(); r.close(); } finally { r.close(); // refused: open || closed } -
An accept with a timeout (java.net.ServerSocket, with
accept()allowedfrom="bound(this)", to="accepted(this)"andfrom="accepted(this)"). This is the standard way to accept with a timeout:ServerSocket s = new ServerSocket(0); s.setSoTimeout(50); try { s.accept(); } catch (IOException timeout) { System.out.println("timed out"); } s.close(); // refused: bound || acceptedAn earlier comparison on an older verifier (321a7321 / 0.0.33) reported both programs as accepted with this spec. I haven't re-run that version. On 1a506fe and f7f366c both are refused. Rewriting
accept()as one alternativefrom = "bound(this) || accepted(this)"moves the error toclose(), which is also written one alternative per state.
- 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