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.
Describe the bug
The
StringEncoderinterface javadoc callsUnsafeStringEncodera "Java 8+" implementation, but it is never created on Java 8.Steps to reproduce
Read the
StringEncoderjavadoc, then followgetInstance()toStringEncoderHolder.createInstance()andUnsafeStringEncoder.createIfAvailable().What did you expect to see?
The documented version matching the
Stringfields the encoder reads.VarHandleStringEncoderand theStringMarshalBenchmarkmessage ("requires Java 9+") already say Java 9+.What did you see instead?
UnsafeStringEncoder.createIfAvailable()(line 41) needs theString.value(byte[]) andString.coderfields 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 getsFallbackStringEncoder, andStringEncoderTestmarks 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.FINElog message only; no behavior change.