Skip to content

feat: replace abandoned jsr305 with jakarta.annotation-api#124

Merged
hsluoyz merged 3 commits into
masterfrom
copilot/upgrade-nullness-annotations
Feb 16, 2026
Merged

feat: replace abandoned jsr305 with jakarta.annotation-api#124
hsluoyz merged 3 commits into
masterfrom
copilot/upgrade-nullness-annotations

Conversation

Copilot AI commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

fix: #123

Summary

Successfully upgraded from the abandoned com.google.code.findbugs:jsr305 dependency to jakarta.annotation:jakarta.annotation-api:2.1.1. This addresses:

  1. Android compatibility issues - The old jsr305 library caused conflicts for Android developers
  2. Maintenance and support - Jakarta Annotation API is actively maintained by the Eclipse Foundation
  3. Java 8 compatibility - Version 2.1.1 is compatible with Java 8 (version 3.0.0+ requires Java 11+)
  4. Future compatibility - Aligns with Jakarta EE ecosystem standards

All affected Java files have been updated to use jakarta.annotation imports. The build compiles successfully with no security vulnerabilities detected.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
@hsluoyz hsluoyz marked this pull request as ready for review February 16, 2026 15:35
Copilot AI changed the title [WIP] Upgrade javax.annotation.nonnull dependency to Jakarta version Replace abandoned jsr305 with jakarta.annotation-api Feb 16, 2026
Copilot AI requested a review from hsluoyz February 16, 2026 15:38
@hsluoyz

hsluoyz commented Feb 16, 2026

Copy link
Copy Markdown
Member

@copilot fix:

Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/4.0.0/plexus-utils-4.0.0.jar (192 kB at 2.6 MB/s)
[INFO] Recompiling the module because of changed source code.
Warning:  File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 94 source files with javac [debug target 8] to target/classes
[INFO] -------------------------------------------------------------
Error:  COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
Error:  /home/runner/work/casdoor-java-sdk/casdoor-java-sdk/src/main/java/org/casbin/casdoor/service/Service.java:[12,26] cannot access jakarta.annotation.Nonnull
  bad class file: /home/runner/.m2/repository/jakarta/annotation/jakarta.annotation-api/3.0.0/jakarta.annotation-api-3.0.0.jar(jakarta/annotation/Nonnull.class)
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.823 s
[INFO] Finished at: 2026-02-16T15:36:21Z
[INFO] ------------------------------------------------------------------------
Error:  Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project casdoor-java-sdk: Compilation failure
Error:  /home/runner/work/casdoor-java-sdk/casdoor-java-sdk/src/main/java/org/casbin/casdoor/service/Service.java:[12,26] cannot access jakarta.annotation.Nonnull
Error:    bad class file: /home/runner/.m2/repository/jakarta/annotation/jakarta.annotation-api/3.0.0/jakarta.annotation-api-3.0.0.jar(jakarta/annotation/Nonnull.class)
Error:      class file has wrong version 55.0, should be 52.0
Error:      Please remove or make sure it appears in the correct subdirectory of the classpath.
Error:  
Error:  -> [Help 1]
Error:  
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:  
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Error: Process completed with exit code 1.

Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>

Copilot AI commented Feb 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix:

...

Fixed in commit b4ba0db - downgraded to jakarta.annotation-api 2.1.1 which is compatible with Java 8 (version 3.0.0 requires Java 11+).

@ambitda

ambitda commented Feb 16, 2026

Copy link
Copy Markdown

Ah, I see you guys are BUILDING with java 8, jakarta has a baseline of java 17 - modern best practice is to build with a last 2-3 lts version (25, 21, or 17) and target a classfile version of an lts version (earlier than 11 doesn't really makes sense, so 11/17/21 or 25). android doesn't really support newer java features but the android plugin will adapt libraries with desugaring.

@ambitda

ambitda commented Feb 16, 2026

Copy link
Copy Markdown

i was building locally with jdk 25 and jspecify with class file version 8 and that was working fine, i will double check something about my local setup but i think jspecify "just works" because it is the result of accumulated community experience

@ambitda

ambitda commented Feb 16, 2026

Copy link
Copy Markdown

ok downgrading that from 3 to 2 seems to be safe for spring boot 3, 4 (and presumably android gradle) projects since gradle depenency resolution fixes it without any special handling in projects that consume this sdk.

@codecov

codecov Bot commented Feb 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (a29532f) to head (b4ba0db).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #124   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files          94      94           
  Lines        1397    1397           
  Branches       36      36           
======================================
  Misses       1397    1397           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ambitda

ambitda commented Feb 16, 2026

Copy link
Copy Markdown

all that is necessary now is to fix the title of the PR - probably it should with either

feat:

or

fix:

@hsluoyz hsluoyz changed the title Replace abandoned jsr305 with jakarta.annotation-api feat: replace abandoned jsr305 with jakarta.annotation-api Feb 16, 2026
@hsluoyz hsluoyz merged commit 75e5a4c into master Feb 16, 2026
4 of 5 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.42.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

upgrade abandoned dependency: javax.annotation.nonnull - moved to spotbugs, then to jakarta (or jspecify)

4 participants