Skip to content

Migrate to JSpecify annotations#6456

Draft
sh-cho wants to merge 9 commits intoline:mainfrom
sh-cho:jspecify-nullable
Draft

Migrate to JSpecify annotations#6456
sh-cho wants to merge 9 commits intoline:mainfrom
sh-cho:jspecify-nullable

Conversation

@sh-cho
Copy link
Copy Markdown
Contributor

@sh-cho sh-cho commented Oct 25, 2025

(Base: #6457)

Motivation:
jsr-305 is dormant and now JSpecify is recommended annotation sets for variety of static analyses (for now, it supports only nullness) and many open sources are moving to JSpecify (e.g. Spring Framework, Guava, ...)

Modifications:

  • Add JSpecify dependency
  • Deprecate internal annotations and replace to JSpecify annotations
    • com.linecorp.armeria.common.annotation.Nullable -> org.jspecify.annotations.Nullable
    • com.linecorp.armeria.common.annotation.NonNullByDefault -> org.jspecify.annotations.NullMarked

Note:
Since JSpecify's Nullable annotation is type-use annotation, placement of existing jsr-305 annotations are incompatible with JSpecify one, so following steps should be applied (ref: https://jspecify.dev/docs/using/#if-your-code-already-uses-jsr-305-annotations)

  • @Nullable Object[] -> Object @Nullable []
  • @Nullable Map.Entry<K, V> -> Map.@Nullable Entry<K, V>

Result:

@sh-cho sh-cho marked this pull request as ready for review October 25, 2025 16:36
@sh-cho
Copy link
Copy Markdown
Contributor Author

sh-cho commented Oct 25, 2025

Need to sort out commits
-> rebase done

@sh-cho sh-cho marked this pull request as draft October 25, 2025 17:13
Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
@sh-cho sh-cho force-pushed the jspecify-nullable branch from a329f31 to b4e359d Compare October 26, 2025 05:11
Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>

Remove temp comment

Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>

Add deprecated comment

Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>

Add indent on imports

Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>

Add indent more

Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
`Type argument is not within its bounds: should be subtype of
'kotlin.Any'.`, etc

Signed-off-by: Seonghyeon Cho <seonghyeoncho96@gmail.com>
@sh-cho sh-cho force-pushed the jspecify-nullable branch from b4e359d to a03482b Compare October 26, 2025 11:17
@sh-cho sh-cho marked this pull request as ready for review October 26, 2025 11:42
@sh-cho

This comment was marked as resolved.

@sh-cho sh-cho marked this pull request as draft October 26, 2025 11:57
@sh-cho sh-cho marked this pull request as ready for review October 26, 2025 15:11
@sh-cho
Copy link
Copy Markdown
Contributor Author

sh-cho commented Nov 12, 2025

I'll open this after #6457 gets merged and rebased

@sh-cho sh-cho marked this pull request as draft November 12, 2025 14:04
minwoox pushed a commit that referenced this pull request Nov 13, 2025
Motivation:

In annotated service, type-use `@Nullable` annotation (ex. jspecify) is not respected.

Modifications:

- Add jspecify dependency
  - (Migration in progress. See #6456)
- In `AnnotatedValueResolver#isAnnotatedNullable`, add checks for type-use nullable annotation

Result:

- Resolves #6454
@github-actions github-actions bot added the Stale label Dec 13, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 2, 2026

Important

Review skipped

Too many files!

150 files out of 300 files are above the max files limit of 150.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@minwoox minwoox removed the Stale label Jan 2, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.32%. Comparing base (8150425) to head (44a902f).
⚠️ Report is 411 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6456      +/-   ##
============================================
- Coverage     74.46%   74.32%   -0.14%     
- Complexity    22234    23625    +1391     
============================================
  Files          1963     2120     +157     
  Lines         82437    88364    +5927     
  Branches      10764    11556     +792     
============================================
+ Hits          61385    65679    +4294     
- Misses        15918    17169    +1251     
- Partials       5134     5516     +382     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@minwoox minwoox added this to the 1.35.0 milestone Jan 2, 2026
@minwoox minwoox marked this pull request as ready for review January 2, 2026 13:50
Copy link
Copy Markdown
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

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

👍 👍

Copy link
Copy Markdown
Contributor

@minwoox minwoox left a comment

Choose a reason for hiding this comment

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

Thanks, @sh-cho!

@minwoox minwoox marked this pull request as draft January 5, 2026 05:05
@minwoox
Copy link
Copy Markdown
Contributor

minwoox commented Jan 5, 2026

It seems like it doesn't work on JDK 8:
https://github.com/jspecify/jspecify/wiki/version-compatibility

I think we probably need to wait until we drop support for JDK 8.

@minwoox minwoox removed this from the 1.35.0 milestone Jan 5, 2026
@github-actions github-actions bot added Stale and removed Stale labels Feb 5, 2026
@github-actions github-actions bot added Stale and removed Stale labels Mar 9, 2026
@github-actions github-actions bot added the Stale label Apr 9, 2026
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.

Use JetBrains's Java annotations?

3 participants