Skip to content

Conversation

@shakuzen
Copy link
Member

@shakuzen shakuzen commented Jun 11, 2025

Migrates from our custom nullability annotations to the jSpecify nullability annotations.

See #5547

Copy link
Member Author

@shakuzen shakuzen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get through everything but left some review comments in addition to the comments left in the code.

@shakuzen shakuzen force-pushed the core-specify branch 4 times, most recently from 3a4f6ef to f59d80a Compare June 12, 2025 07:25
Copy link
Member Author

@shakuzen shakuzen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another review in the meantime. I still haven't managed to resolve all the NullAway errors to apply the migration of @NonNullApi

*/
@Nullable
public <T> T gauge(String name, Iterable<Tag> tags, @Nullable T stateObject, ToDoubleFunction<T> valueFunction) {
public <T> @Nullable T gauge(String name, Iterable<Tag> tags, @Nullable T stateObject,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be consistent with Gauge and Function* types. I'd vote for marking the state object as non-nullable for the reasons stated elsewhere: if the user knows the state object is nullable, they may as well not register a meter with it.

shakuzen and others added 3 commits June 13, 2025 14:04
There are still a number of NullAway errors to take care of, but I'm committing the work-in-progress.
It seems assertThat(obj).isNotNull(); does not qualify as a null-check
for NullAway if obj is a collection.

See uber/NullAway#1219
It seems <T extends @nullable Object> does not work well
in some situations.

See uber/NullAway#1075
@shakuzen shakuzen marked this pull request as ready for review June 16, 2025 00:55
@shakuzen shakuzen changed the title WIP migrate micrometer-core to jSpecify Migrate micrometer-core to jSpecify Jun 16, 2025
@shakuzen shakuzen marked this pull request as draft June 16, 2025 01:28
default Enum<?> overridesDefaultMetricFrom() {
// TODO should this be nullable?
default @Nullable Enum<?> overridesDefaultMetricFrom() {
return null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't really sure how this is used and marking it @Nullable is probably fine. We can follow-up if we want to change it.

@shakuzen shakuzen merged commit e45501f into micrometer-metrics:main Jun 17, 2025
9 checks passed
@shakuzen shakuzen deleted the core-specify branch June 17, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants