Skip to content

[Enhancement] Add Nullable annotations to nullable Message getters and fix kotlin-stdlib transitive leak #10978

Description

@obabichevjb

Before Creating the Enhancement Request

  • I have confirmed that this should be classified as an enhancement rather than a bug/feature.

Summary

Two independent issues:

  1. Seven getters in Message.java return null at runtime but have no nullability metadata. This causes silent NPEs and prevents both Java IDEs and Kotlin from warning the caller.
  2. A pure-Java project depending on rocketmq-client transitively receives kotlin-stdlib on its classpath via an uncovered okhttp dependency edge.

Motivation

Nullable getters: getTags(), getKeys(), getProperty(), getUserProperty(), getBuyerId(), getProperties(), and getTransactionId() all return null under normal conditions (e.g., getKeys() is null unless explicitly set; getTags() is null when the producer omitted the tag). A Java user reported the same getTags() null problem in #1453 in 2019 — the issue was closed with no annotation or fix.

kotlin-stdlib leak: Upstream already wrote kotlin-stdlib exclusions for the okio-jvm dependency edge. However, an independent path — opentelemetry-exporter-otlpopentelemetry-exporter-sender-okhttpokhttp — still brings kotlin-stdlib in. This ships Kotlin's runtime to every user, including pure-Java projects that have no Kotlin dependency.

Describe the Solution You'd Like

Nullable getters: Add @Nullable (javax.annotation.Nullable, already available via org.apache.tomcat:annotations-api) to the seven affected getters in Message.java. This is a pure-metadata change with zero behavioral impact.

kotlin-stdlib leak: Extend the exclusion to cover com.squareup.okhttp3:okhttp and com.squareup.okhttp3:okhttp:3.x (which transitively pulls kotlin-stdlib-jdk8 and kotlin-stdlib-jdk7) in the opentelemetry-exporter-otlp dependency declaration. This enforces the constraint upstream already wrote for okio-jvm — no new policy decision required.

Describe Alternatives You've Considered

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions