Skip to content

ValueResolver and ValueExpressionResolver nullability is inconsistent #6280

@shakuzen

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions