Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

KeyValueAndUnitData.create() returns a package-private type

Open Beginner friendly
#8,870 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
91/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
api

Research direction

Open sdk/profiles/src/main/java/io/opentelemetry/sdk/profiles/data/KeyValueAndUnitData.java and inspect KeyValueAndUnitData.create(int, Value<?>, int). Confirm the reproduction from another package, then make the factory expose the public KeyValueAndUnitData type. Done means the getter call compiles directly, matching the other ten *Data.create() factories.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
2d 19h
Merged PRs (30d)
63

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-telemetry/opentelemetry-java

All issues in open-telemetry/opentelemetry-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.