bug: class initialization can re-enter `B2JsonHandlerMap.getHandler`

Đang mở
#86 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 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
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
backend

Hướng nghiên cứu

Start with the testClassInitializationInDefaultValue reproduction in the issue and trace how B2Json.fromJsonOrThrowRuntime obtains a handler through B2JsonHandlerMap.getHandler. The issue gives no source or test file path, so locate the existing regression tests and handler implementation first. Done means the reproduction passes when a default value's class initializer re-enters handler lookup.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

This test case triggers the problem:

    /**
     * A regression test for a case where a class has a field with a default value,
     * and the class of the default value has a class initializer.
     */
    @Test
    public void testClassInitializationInDefaultValue() {
        B2Json.fromJsonOrThrowRuntime("{}", TestClassInit_ClassWithDefaultValue.class);
    }

    private static class TestClassInit_ClassWithDefaultValue {

        @B2Json.optionalWithDefault(defaultValue = "{}")
        private final TestClassInit_ClassThatDoesInitializition objThatDoesInit;

        @B2Json.constructor(params = "objThatDoesInit")
        private TestClassInit_ClassWithDefaultValue(TestClassInit_ClassThatDoesInitializition objThatDoesInit) {
            this.objThatDoesInit = objThatDoesInit;
        }
    }

    private static class TestClassInit_ClassThatDoesInitializition {

        private static TestClassInit_ClassThatDoesInitializition defaultValue =
                B2Json.fromJsonOrThrowRuntime("{}", TestClassInit_ClassThatDoesInitializition.class);

        @B2Json.constructor(params = "")
        TestClassInit_ClassThatDoesInitializition() {}
    }
Ngôn ngữ chính
Java
Star
103
Fork
23
Merge trung bình
5 ngày 8 giờ
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Backblaze/b2-sdk-java

Tất cả issue của Backblaze/b2-sdk-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.