Annotation Type NonnullByDefault


  • @Documented
    @TypeQualifierDefault({METHOD,PARAMETER,TYPE_PARAMETER})
    @Nonnull
    @Retention(RUNTIME)
    @Target(PACKAGE)
    public @interface NonnullByDefault
    Indicates that method return types and method parameters in the annotated package are Nonnull unless explicitly annotated with Nullable.

    This annotation is a generalization of ParametersAreNonnullByDefault. All Pkl packages containing Java code should carry this annotation.

    Ideally, this default would apply to every ElementType.TYPE_USE, but I haven't been able to make this work reasonably in IntelliJ (https://youtrack.jetbrains.com/issue/IDEA-278618).