Skip to content

ValueResolver and ValueExpressionResolver nullability is inconsistent #6280

Closed

Description

@shakuzen

I agree. Since ValueResolver has a pair: ValueExpressionResolver I think we should keep the two in-sync but since they are different now, we should change one of them:

  1. Mark ValueResolver#resolve @Nullable, like ValueExpressionResolver#resolve is also @Nullable. We already do a null-check here: but we need to verify this across the codebase.
  2. Keep ValueResolver#resolve @NonNull but maybe we should also mark ValueExpressionResolver#resolve @NonNull (right now it's @Nullable).

If we decide to keep them out of sync as they are now returning "" instead of null should not cause an issue in Micrometer's codebase since we are already mapping null to "" (see above) and NoOpValueResolver is more like a "marker", it should not be called but we need to verify this across the codebase.

Originally posted by @jonatan-ivanov in #6270 (comment)

Activity

  1. added theissue type on May 22, 2025
  2. added this to the 1.16.0-M1 milestone on May 22, 2025
  3. shakuzen commented on May 22, 2025

    @shakuzen
    MemberAuthor

    Since both ValueResolver and ValueExpressionResolver are defined as providing a KeyValue's value, and that cannot be null, I think we should do 2, which is, in some sense a breaking change on the specified nullability, but I think it's correcting a bug in the nullability.

    Another inconsistency is the nullability of parameter - @Nullable in VER but not nullable in VR.

  4. added a commit that references this issue on May 22, 2025
    a587346
  5. added a commit that references this issue on May 23, 2025
    eebbe17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions