Skip to content

StringEncoder javadoc documents the wrong Java version for UnsafeStringEncoder #8709

Description

@thswlsqls

Describe the bug

The StringEncoder interface javadoc calls UnsafeStringEncoder a "Java 8+" implementation, but it is never created on Java 8.

Steps to reproduce

Read the StringEncoder javadoc, then follow getInstance() to StringEncoderHolder.createInstance() and UnsafeStringEncoder.createIfAvailable().

What did you expect to see?

The documented version matching the String fields the encoder reads. VarHandleStringEncoder and the StringMarshalBenchmark message ("requires Java 9+") already say Java 9+.

What did you see instead?

UnsafeStringEncoder.createIfAvailable() (line 41) needs the String.value (byte[]) and String.coder fields and returns null if either is missing; Java 8 has neither. The inline comment on line 42 says "this only exists in Java 9+", so Java 8 gets FallbackStringEncoder, and StringEncoderTest marks the Unsafe tests @DisabledOnJre(JRE.JAVA_8) for the same reason. The wording came from #7701 and #8621 carried it over unchanged.

Separately, #8637 added an Android (Dalvik) early return to StringEncoderHolder.createUnsafeEncoder(), but the same javadoc bullet still lists only the Java version condition.

What version and what artifacts are you using?

Artifacts: opentelemetry-exporter-common
Version: main @ d948e13
How did you reference these artifacts? N/A — reading source.

Environment

Compiler: Temurin 21
OS: N/A

Additional context

Javadoc and one Level.FINE log message only; no behavior change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions