False error: a local declared inside try is "not found" at a call in finally
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 20/100
Línea de trabajo
Start by reproducing the report: save the Repro class from the issue and run LiquidJava on it to see the Not Found Error at input.close() in the finally. The cause is that the state of input recorded at the end of the try still mentions the block-local length, which is out of scope when the finally checks close(). Done means the repro passes verification and the change does not break the existing tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
With the Barista BufferedInputStream spec (read() returns _ >= -1; read(byte[], int, int) refines its length):
import java.io.*;
public class Repro {
static int load(InputStream raw, boolean known) throws IOException {
BufferedInputStream input = new BufferedInputStream(raw);
try {
int cost = 0;
if (known) {
int length = input.read();
if (length >= 0) {
byte[] nonce = new byte[length];
input.read(nonce, 0, length);
}
}
return cost;
} finally {
input.close();
}
}
}
On main 1c6807be (and 321a7321):
Not Found Error: Variable 'length' could not be found
input.close(); (in the finally)
length is a block-local of the try; the state of input recorded in the try (after read(nonce, 0, length)) mentions it, and when the finally checks close() against that state, length is out of scope. Expected: Correct! Passed Verification. (out-of-scope locals should be eliminated or kept as fresh variables when the state flows into the finally / after the block).
Found in a real-code example (secrets-for-android FileUtils, a length-prefixed read in try/finally). Since #366 the example's earlier workaround (guarding with a block instead of an early return) no longer avoids it.
- Lenguaje dominante
- Java
- Estrellas
- 69
- Forks
- 36
- Merge medio
- 2 d 1 h
- PR fusionados (30 d)
- 35
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
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
liquid-java/liquidjava#395 ·
Los mantenedores suelen responder en 2 días
-
Verifier crashes on a comparison or other binary operator whose operand types cannot be resolved (classes not on the classpath)Posiblemente ocupada @CatarinaGamboa la tomó hace 3 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
liquid-java/liquidjava#388 ·
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
liquid-java/liquidjava#373 ·
Los mantenedores suelen responder en 2 días
-
Soundness: a local variable with a constant's name shadows the constant (Format.JPG read as local JPG)Posiblemente ocupada @CatarinaGamboa la tomó hace 3 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
liquid-java/liquidjava#321 ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 40/100
liquid-java/liquidjava#405 ·
Los mantenedores suelen responder en 2 días
Todos los issues de liquid-java/liquidjava
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
scylladb/scylla-cdc-source-connector#350 ·
Los mantenedores suelen responder en 1 día
-
agent:working documentation enhancement go:build lane:needs-decision
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Sanne/incus-spawn#1435 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
area:shuffle bug priority:high requires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/datafusion-comet#7062 ·
Los mantenedores suelen responder en 1 día
-
wait for review
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
enhancement good first issue up-for-grabs
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
AnikethTS/ChangeRadar#22 ·
Los mantenedores suelen responder en 1 día