Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
This repository was archived by the owner on Nov 9, 2026. It is now read-only.

Support JSpecify "nullness" annotations. #1335

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

Activity

  1. added
    generator
    on May 12, 2025
  2. added theissue type on May 12, 2025
  3. jonpryor commented on Jun 3, 2025

    @jonpryor
    Contributor

    Related: 07d5595, which adds parsing of Module information.

    We may also need to add support for parsing package-info.class; Java allows packages to have annotations, which @NullMarked supports, a'la:

    // src/example/package-info.java
    @NullMarked
    package example;

    It's an otherwise "normal" .class file, with ThisClass being example/package-info. There could be a package-info.java for each separate package; there is no "inheritance", e.g. annotations on package example do not impact package example.nested.

  4. added a commit that references this issue on Jul 6, 2026
    d6951e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    generator

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions