Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

KeyValueAndUnitData.create() returns a package-private type

Đang mở Phù hợp với người mới
#8,870 0 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 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
91/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
api

Hướng nghiên cứu

Mở sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/KeyValueAndUnitData.java và kiểm tra KeyValueAndUnitData.create(int, Value<?>, int). Xác nhận việc tái hiện từ một package khác, sau đó làm cho factory expose kiểu public KeyValueAndUnitData. Hoàn tất khi lệnh gọi getter biên dịch trực tiếp, tương tự như mười factory *Data.create() còn lại.

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

Mô tả

Describe the bug
KeyValueAndUnitData.create(int, Value<?>, int) declares the package-private ImmutableKeyValueAndUnitData as its return type. Code outside io.opentelemetry.sdk.profiles.data cannot call a getter directly on the result.

Steps to reproduce
From any other package, compile:
KeyValueAndUnitData.create(1, Value.of("v"), 2).getKeyStringIndex();

What did you expect to see?
It compiles. The method's Javadoc says it returns a KeyValueAndUnitData, and the other ten *Data.create() factories in the package return their public interface type.

What did you see instead?

error: KeyValueAndUnitData.getKeyStringIndex() is defined in an inaccessible class or interface

Declared at KeyValueAndUnitData.create() (sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/KeyValueAndUnitData.java line 21). Assigning the result to a KeyValueAndUnitData variable first works, which is why in-repo callers compile.

What version and what artifacts are you using?
Artifacts: opentelemetry-sdk-profiles (alpha)
Version: main @ ce32c1205
How did you reference these artifacts? N/A (repo build)

Environment
Compiler: Temurin 21 (--release 8)
OS: N/A

Additional context
Fix: change the declared return type to KeyValueAndUnitData.

Ngôn ngữ chính
Java
Star
2.5k
Fork
1k
Merge trung bình
2 ngày 19 giờ
Pull request đã merge (30 ngày)
63

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

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 open-telemetry/opentelemetry-java

Tất cả issue của open-telemetry/opentelemetry-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.