Skip to content

Require JSpecify annotations on new Public API and Experimental API classes #3892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dondonz
Copy link
Member

@dondonz dondonz commented Apr 5, 2025

Resolves #3877

This PR adds an ArchUnit test to require new Public API and Experimental API classes have the @NullMarked annotation on the class. See the documentation: https://jspecify.dev/docs/user-guide/#nullmarked

I put a PR up so it's easier to have a discussion, I'm open to ideas.

I originally tried to allow list all classes, but because we're starting off from almost zero, we have another 1,200 classes to go. That's a very, very long allow list! I thought instead we can start with public & experimental API classes, which is a mere ~350 classes. This would add the most value for users of the library.

I had thought about using Git to collect a list of new classes, but I don't want to spin up a new process every time we do a test run.

Sample test output

https://github.com/graphql-java/graphql-java/actions/runs/14279382170/job/40027003549?pr=3892

JSpecifyAnnotationsCheck > ensure all public API and experimental API classes have @NullMarked annotation STANDARD_OUT
    The following public API and experimental API classes are missing @NullMarked annotation:
                graphql.AssertException
            
    Add @NullMarked to these public API classes and add @Nullable annotations where appropriate. See documentation at https://jspecify.dev/docs/user-guide/#nullmarked

JSpecifyAnnotationsCheck > ensure all public API and experimental API classes have @NullMarked annotation FAILED
    Condition not satisfied:

    false

    Found 1 public API and experimental API classes missing @NullMarked annotation
        at graphql.JSpecifyAnnotationsCheck.ensure all public API and experimental API classes have @NullMarked annotation(JSpecifyAnnotationsCheck.groovy:394)

Copy link
Contributor

github-actions bot commented Apr 5, 2025

Test Results

  314 files    314 suites   51s ⏱️
3 587 tests 3 582 ✅ 5 💤 0 ❌
3 676 runs  3 671 ✅ 5 💤 0 ❌

Results for commit 3c3e1a7.

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enforce JSpecify annotations on new classes
1 participant