Migrate from JSR-305 to JSpecify#443
Migrate from JSR-305 to JSpecify#443erik-meuwese-topicus wants to merge 5 commits intoapache:masterfrom
Conversation
| <scope>compile</scope> | ||
| <groupId>org.jspecify</groupId> | ||
| <artifactId>jspecify</artifactId> | ||
| <version>1.0.0</version> |
There was a problem hiding this comment.
Compile is the default scope, used if none is specified. I added the scope to the dependency.
|
why not. |
elharo
left a comment
There was a problem hiding this comment.
@olamy beat me to it with my favorite xkcd
I don't want to add yet another new random dependency. If we're not majorly using these, and I don't think we are, and it's really causing an otherwise unfixable problem, let's just remove the nullability annotations
elharo
left a comment
There was a problem hiding this comment.
Maven Build Cache Extension depends on JSR-250: Common Annotations for the Java Platform (javax.annotation) which exports the javax.annotation package. The JSR-305: Annotations for Software Defect Detection (jsr305) part of Google Findbugs also exports the javax.annotation package. With JPMS it's not possible to compile having both dependencies.
Do we in fact have both dependencies? Why? Can we just get rid of findbugs?
If this is an actual problem, why are we not seeing it in the CI?

Migrate from JSR-305 tot JSpecify
Maven Build Cache Extension depends on JSR-250: Common Annotations for the Java Platform (javax.annotation) which exports the
javax.annotationpackage. The JSR-305: Annotations for Software Defect Detection (jsr305) part of Google Findbugs also exports thejavax.annotationpackage. With JPMS it's not possible to compile having both dependencies.JSpecify standerdizes the
@Nullableand@NonNullannotations.Changes
@javax.annotation.Nonnulland@javax.annotation.Nullableannotation to the@org.jspecify.annotations.NonNulland@org.jspecify.annotations.Nullableannotations@Nullableto return values and parameters which could be nullPluginScanConfigImplisSkip()andaccept(tagName)to prevent NullPointenException when dto is null@NonNullto return values ofCacheContextandCacheResultfor values set withrequireNonNull(value)@NonNullto@NullableinRemoteCacheRepositorygetResourceUrl(context, filename)because implementationRemoteCacheRepositoryNoOpreturnednullso it's nullableFurther improvement
When Maven Build Cache Extesion changes
<javaVersion>8</javaVersion>in the pom.xml to Java 9+. Then it would become possible to remove all@NonNullannotations and annotate the packages with@NullMarked. Because@NullMarkedtargetsMODULEwhich has been added in Java 9 soMODULEis not compatible with Java 8. With@NullMarkedevery return value and parameter is considered@NonNullunless annotated with@Nullable. This reduces the amount of annotations needed.