question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrate off of jsr305

See original GitHub issue

There are several issues with using jsr305.jar by Guava.

JSR-305 is dormant, has been for a long while and shows no hope of ever producing an agreed set of annotations in our lifetime. Further more these annotations use javax. packages which it is not possible to use according to the Oracle Java binary licence, so applications can not use and ship these dependencies along with a JRE without violating the Oracle licence agreement.

F. JAVA TECHNOLOGY RESTRICTIONS. You may not create, modify, or change the behavior of, or authorize your licensees to create, modify, or change the behavior of, classes, interfaces, or subpackages that are in any way identified as “java”, “javax”, “sun”, “oracle” or similar convention as specified by Oracle in any naming convention designation.

The JSR-305 group has not defined any official releases according to its jsr page so the only implementations is a seemingly random implementation provided by the FindBugs team. Even if the team where experts on the JSR (which some where) they are not official as there has been no vote and are not available from the JSR hompage - so the javax package name restriction still applies.

Using jsr305 causes additional issues, if Guava is used in a modular JDK9 applications, because it puts the annotations into javax.annotation package, which is also used by a couple of other JAR-s and a legacy JDK module java.xml.ws.annotation. If one wants to create a modular JDK9 application with two dependencies to conflicting JAR-s, Java refuses to compile and run it because of a package split. Example:

  • Guava -> forces us to require jsr305 automatic module,
  • Dagger -> forces us to require either java.xml.ws.annotation or jsr250 automatic module.

All of the modules use javax.annotation.

Findbugs has been rebooted as Spotbugs and they are going to make a switch from JSR-305 to their own internal annotations in version 4.0.0 that do not break anything:

https://github.com/spotbugs/spotbugs/pull/180

I think Guava should consider switching to them in order not to pollute application dependencies with jsr305 JAR.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:47
  • Comments:75 (31 by maintainers)

github_iconTop GitHub Comments

27reactions
kevinb9ncommented, Jan 13, 2020

Everyone: I’m sorry the state of things re: nullness annotations is such a disaster. For better or worse, all I can tell you is that cpovirk and I (and many others) are working on the long term solution: a proper artifact that will be embraced by all major tools, with clear, strong specifications. Alas, this will take time to come to fruition and in the meantime things will continue to be a mess.

We don’t have public materials you can review yet at this time.

17reactions
cpovirkcommented, Mar 6, 2020

Nullability annotations update:

  • We have our domains registered, and we’re serving a stub page from one of them.
  • We don’t yet have real content for that page.
  • We don’t yet have the GitHub project opened up for public access. (Last I heard, we had an informal approval from the person we needed but hadn’t gotten that officially written down.)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Migrate off of jsr305 - - Bountysource
Migrate off of jsr305. ... There are several issues with using jsr305.jar by Guava. JSR-305 is dormant, has been for a long while...
Read more >
Making JSR 305 Work On Java 9 - nipafx.dev
Generated from the JDK). This is called a split package and I explain it in more detail in the Java 9 migration guide....
Read more >
Lukas Eder on Twitter: "@tomsontom The EPL 2.0 makes ...
Migrate off of jsr305 · Issue #2960 · google/guava. There are several issues with using jsr305.jar by Guava. JSR-305 is dormant, has been...
Read more >
remove some findbugs jsr305 useless dependencies (I6911be93 ...
TODO: migrate remaining jsr305 dependencies to a more recent solution https://groups.google.com/g/jenkinsci-dev/c/uE1wwtVi1W0 Signed-off-by: ...
Read more >
Newest 'jsr305' Questions - Stack Overflow
Why does Findbugs JSR305 break OSGi package export of javax.annotations in ... which would have avoided a bug I just found making it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found