False error: a local declared inside try is "not found" at a call in finally
Mantenedores costumam responder em até 2 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 20/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Java
- Estrelas
- 69
- Forks
- 36
- Merge médio
- 2d 1h
- PRs com merge (30d)
- 35
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de liquid-java/liquidjava
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
liquid-java/liquidjava#395 ·
Mantenedores costumam responder em até 2 dias
-
Verifier crashes on a comparison or other binary operator whose operand types cannot be resolved (classes not on the classpath)Talvez já em andamento @CatarinaGamboa assumiu há 3 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
liquid-java/liquidjava#388 ·
Mantenedores costumam responder em até 2 dias
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
liquid-java/liquidjava#373 ·
Mantenedores costumam responder em até 2 dias
-
Soundness: a local variable with a constant's name shadows the constant (Format.JPG read as local JPG)Talvez já em andamento @CatarinaGamboa assumiu há 3 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
liquid-java/liquidjava#321 ·
Mantenedores costumam responder em até 2 dias
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 40/100
liquid-java/liquidjava#405 ·
Mantenedores costumam responder em até 2 dias
Todas as issues de liquid-java/liquidjava
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
scylladb/scylla-cdc-source-connector#350 ·
Mantenedores costumam responder em até 1 dia
-
agent:working documentation enhancement go:build lane:needs-decision
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Sanne/incus-spawn#1435 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
area:shuffle bug priority:high requires-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/datafusion-comet#7062 ·
Mantenedores costumam responder em até 1 dia
-
wait for review
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
-
enhancement good first issue up-for-grabs
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 80/100
AnikethTS/ChangeRadar#22 ·
Mantenedores costumam responder em até 1 dia