Skip to content

Java 26 warning from reflective mutation of Byte Buddy AgentBuilder.Default.transformations under JEP 500 #17776

@unalpolat

Description

@unalpolat

Describe the bug

When running the OpenTelemetry Java agent on Java 26, the JVM emits the following warning during startup:

From inspection of the packaged agent jar, this appears to come from OpenTelemetry reflectively replacing Byte Buddy's final transformations field on AgentBuilder$Default.

This is especially relevant on Java 26 because of JEP 500, which warns about reflective mutation of final fields:
https://openjdk.org/jeps/500

In Byte Buddy, AgentBuilder.Default declares the field:

protected final List<Transformation> transformations;

Byte Buddy AgentBuilder.java#L10717

OpenTelemetry Java agent, net.bytebuddy.agent.builder.AgentBuilderUtil reflectively accesses and mutates this field:

OpenTelemetry AgentBuilderUtil.java#L135

WARNING: Final field transformations in class net.bytebuddy.agent.builder.AgentBuilder$Default has been mutated reflectively by class net.bytebuddy.agent.builder.AgentBuilderUtil in unnamed module @4e08711f (file:/otel.jar)

Steps to reproduce

Run an application with the OpenTelemetry Java agent on Java 26.

Example startup shape:

java -javaagent:/path/to/otel.jar -jar app.jar
On startup, the JVM emits:

WARNING: Final field transformations in class net.bytebuddy.agent.builder.AgentBuilder$Default has been mutated reflectively by class net.bytebuddy.agent.builder.AgentBuilderUtil in unnamed module @4e08711f (file:/otel.jar)

Expected behavior

Ideally the agent should avoid reflective mutation of final fields on Java 26+, or have a compatibility path that does not trigger JEP 500 warnings.

At minimum, it would be helpful to know:

  • whether this warning is expected and safe
  • whether there is a plan to remove this reflective final-field mutation
  • whether there is a supported workaround besides JVM flags such as: --enable-final-field-mutation=ALL-UNNAMED, --illegal-final-field-mutation=allow

Actual behavior

The application starts with the JVM warning above when the OpenTelemetry Java agent is enabled on Java 26.

Javaagent or library instrumentation version

v2.26.1

Environment

JDK: 26
OS: Alpine 3.23
Embedded Byte Buddy: 1.18.7
Base image: eclipse-temurin:26-jre-alpine

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions