False error: a local declared inside try is "not found" at a call in finally
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 20/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Java
- Star
- 69
- Fork
- 36
- Merge trung bình
- 2 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 35
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của liquid-java/liquidjava
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
liquid-java/liquidjava#395 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Verifier crashes on a comparison or other binary operator whose operand types cannot be resolved (classes not on the classpath)Có thể đã có người làm @CatarinaGamboa đã nhận 3 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
liquid-java/liquidjava#388 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
liquid-java/liquidjava#373 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Soundness: a local variable with a constant's name shadows the constant (Format.JPG read as local JPG)Có thể đã có người làm @CatarinaGamboa đã nhận 3 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
liquid-java/liquidjava#321 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 40/100
liquid-java/liquidjava#405 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của liquid-java/liquidjava
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/rocketmq-dashboard#6872 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ADORSYS-GIS/token-status-link#168 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ADORSYS-GIS/keycloak-oid4vp-plugin#232 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Wrong link to test resultsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
docs(site): Mermaid edge-label contrast on Architecture and a table header on How it comparesĐang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
devops-thiago/ThrillhouseBot#1132 ·
Maintainer thường phản hồi trong vòng 1 ngày