You can use this answer to create your own simple @EverythingIsNonnullByDefault annotation to be applied at the package / class level to cover all cases, or this one that shows you how to create separate annotations to control the fields and return values ββof a method. We decided to use all of them, but, as a rule, we use the βallβ version at the package level.
If you're really in a hurry, copy-n-paste the legacy annotation and delete the legacy version.
package com.sample; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.annotation.meta.TypeQualifierDefault; @Documented @Nonnull @TypeQualifierDefault(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface ReturnValuesAreNonnullByDefault {
source share