Skip to content

Support JSpecify "nullness" annotations. #1335

@jpobst

Description

@jpobst

Context: dotnet/android-libraries#1136
Context: https://developer.android.com/jetpack/androidx/releases/core#1.16.0

In version 1.16 of AndroidX "core", Google switched from using their androidx.annotation.NonNull types to new "industry-standard" "JSpecify nullness annotations". (Documentation)

Because generator does not support these annotations, all types that were previously "not-null" now appear to be "nullable".

We will need to extend generator to understand these new annotations to generate correct NRT code, as this is potentially just the beginning of Google migrating the entire AndroidX ecosystem to use them.

Note that these new annotations appear more complex than what we currently support, as you can mark a module/package/class/method as @NullMarked which means all types in that scope are considered "not-null" unless otherwise annotated. Scopes below a @NullMarked scope can additionally be marked as @NullUnmarked which undoes @NullMarked for the annotated scope.

JSpecify Nullness User Guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    generatorIssues binding a Java library (generator, class-parse, etc.)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions