-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Migrate micrometer-core to jSpecify #6385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
shakuzen
left a comment
There was a problem hiding this 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.
micrometer-core/src/main/java/io/micrometer/core/instrument/FunctionCounter.java
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/lang/NonNullFields.java
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/util/package-info.java
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/search/MeterNotFoundException.java
Outdated
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/FunctionCounter.java
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/Meter.java
Outdated
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/Meter.java
Outdated
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CacheMeterBinder.java
Outdated
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/CacheMeterBinder.java
Show resolved
Hide resolved
3a4f6ef to
f59d80a
Compare
shakuzen
left a comment
There was a problem hiding this 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
micrometer-core/src/main/java/io/micrometer/core/instrument/LongTaskTimer.java
Outdated
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/MeterRegistry.java
Outdated
Show resolved
Hide resolved
| */ | ||
| @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, |
There was a problem hiding this comment.
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.
micrometer-core/src/main/java/io/micrometer/core/instrument/Timer.java
Outdated
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/Timer.java
Outdated
Show resolved
Hide resolved
...er-core/src/main/java/io/micrometer/core/instrument/config/MeterRegistryConfigValidator.java
Outdated
Show resolved
Hide resolved
...re/src/main/java/io/micrometer/core/instrument/distribution/AbstractTimeWindowHistogram.java
Outdated
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/distribution/TimeWindowMax.java
Show resolved
Hide resolved
.../src/main/java/io/micrometer/core/instrument/observation/DefaultMeterObservationHandler.java
Show resolved
Hide resolved
micrometer-core/src/test/java/io/micrometer/core/instrument/push/PushMeterRegistryTest.java
Show resolved
Hide resolved
micrometer-core/src/test/java/io/micrometer/core/instrument/push/PushMeterRegistryTest.java
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/FunctionCounter.java
Show resolved
Hide resolved
micrometer-core/src/main/java/io/micrometer/core/instrument/MeterRegistry.java
Outdated
Show resolved
Hide resolved
There are still a number of NullAway errors to take care of, but I'm committing the work-in-progress.
e3761e9 to
94f183b
Compare
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
94f183b to
fda7fdb
Compare
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/ProcessorMetrics.java
Outdated
Show resolved
Hide resolved
samples/micrometer-samples-core/src/main/java/io/micrometer/core/samples/NullGaugeSample.java
Show resolved
Hide resolved
...er-core/src/main/java/io/micrometer/core/instrument/config/MeterRegistryConfigValidator.java
Show resolved
Hide resolved
| default Enum<?> overridesDefaultMetricFrom() { | ||
| // TODO should this be nullable? | ||
| default @Nullable Enum<?> overridesDefaultMetricFrom() { | ||
| return null; |
There was a problem hiding this comment.
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.
Migrates from our custom nullability annotations to the jSpecify nullability annotations.
See #5547