Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

KeyValueAndUnitData.create() returns a package-private type

クローズ 初心者向け
#8,870 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
91/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
api

調査の方向性

sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/KeyValueAndUnitData.java を開き、KeyValueAndUnitData.create(int, Value<?>, int) を調べます。別のパッケージからの再現を確認し、その後、factory が public な KeyValueAndUnitData 型を公開するようにします。他の 10 個の *Data.create() factory と同様に、getter の呼び出しを直接コンパイルできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Java
スター
2.5k
フォーク
1k
平均マージ
2日 21時間
マージ済み PR(30日)
74

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

open-telemetry/opentelemetry-java のほかの issue

open-telemetry/opentelemetry-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。