Replace nullness annotations with JSpecify#309
Conversation
|
If necessary, I can split this PR into smaller parts, for example PR per package, it may be easier to track changes |
piotrooo
left a comment
There was a problem hiding this comment.
Firstly, thanks for your work!
Secondly, sorry for the late response 😭
Regarding the code - one thing: for the return method, I prefer placing the annotation at the method level rather that next to the return type.
This is described in the Google Java Style Guide.
Use:
@Nullable
public static String coerce(@NotNull final String version)
Instead:
public static @Nullable String coerce(final String version)
|
Sure - javac will generate exactly the same byte code for Worth to mention: JSpecify's |
|
Okay, I moved the |
Replace nullness annotations with JSpecify.
Related issue #308
Changes in this PR:
org.jetbrains:annotationsreplaced withorg.jspecify:jspecify(docs)@NonNullannotations with@NullMarkedannotation - to mark all types in the class scope as non-null by default (docs)@Nullableannotations to types@Nullable public static Semver->public static @Nullable Semver@Nullable final String version->final @Nullable String versionorg.jetbrains.annotations.ApiStatus.AvailableSinceannotation - we have same info in the JavaDoc@sincetagsrc/test/java/org/semver4j/internal/range/processor/ProcessorTest.javafile (when we implement an interface, we should keep the same type annotations)