FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add ArchUnit rule to ban javax & JetBrains nullability annotations by dondonz · Pull Request #3985 · graphql-java/graphql-java · GitHub

Add ArchUnit rule to ban javax & JetBrains nullability annotations - #3985

Merged
dondonz merged 2 commits into
masterfrom
enforce-jspecify-and-no-other-nullability-libs
May 27, 2025
Merged

Add ArchUnit rule to ban javax & JetBrains nullability annotations#3985
dondonz merged 2 commits into
masterfrom
enforce-jspecify-and-no-other-nullability-libs

Conversation

dondonz commented May 23, 2025

Copy link
Copy Markdown
Member

Going forward we will be using JSpecify Nullability annotations.

It's possible to accidentally pull in the old javax Nullability annotations because this doesn't need any changes to our build.gradle dependencies.

While it's unlikely someone would accidentally add JetBrains Nullability annotations, because these require a new dependency to be added, I have also banned them.

Sample test output when a banned usage is found:

We are using JSpecify nullability annotations only. Please change the following to use JSpecify instead:
- Parameter <java.util.concurrent.CompletableFuture<T>> of method <graphql.execution.Async.orNullCompletedFuture(java.util.concurrent.CompletableFuture)> is annotated with <javax.annotation.Nullable> in (Async.java:0)

dondonz added this to the 25.x breaking changes milestone May 23, 2025
Comment thread build.gradle
-exportcontents: graphql.*
-removeheaders: Private-Package
Import-Package: !android.os.*,!com.google.*,!org.checkerframework.*,!javax.annotation.*,!graphql.com.google.*,!org.antlr.*,!graphql.org.antlr.*,!sun.misc.*,org.jspecify.annotations;resolution:=optional,*
Import-Package: !android.os.*,!com.google.*,!org.checkerframework.*,!graphql.com.google.*,!org.antlr.*,!graphql.org.antlr.*,!sun.misc.*,org.jspecify.annotations;resolution:=optional,*

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

While I'm here, we can clean up our config to remove javax.annotation

Copy link
Copy Markdown
Contributor

Test Results

  317 files    317 suites   2m 28s ⏱️
3 655 tests 3 650 ✅ 5 💤 0 ❌
3 744 runs  3 739 ✅ 5 💤 0 ❌

Results for commit 08c8bd3.

Copy link
Copy Markdown
Member

We also need to add this to gradle itself, right? Or am I missing something here?

dondonz commented May 26, 2025

Copy link
Copy Markdown
Member Author

We also need to add this to gradle itself, right? Or am I missing something here?

This runs as a standard test. If there's a violation, it'll turn up in our usual build as a failing test

Or did you mean about adding ArchUnit as a dependency? It was already added in another PR that added a rule

dondonz merged commit 27a71b2 into master May 27, 2025
dondonz deleted the enforce-jspecify-and-no-other-nullability-libs branch May 27, 2025 08:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL