Skip to content
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

Add runtime dependency for JSR305 and export annotations #1764

Conversation

matthiasblaesing
Copy link
Contributor

The annotations defined in the Common Annotations module depend
on the annotations defined in JSR305. If they are not present, a
warning is generated from javac.

The annotations defined in the Common Annotations module depend
on the annotations defined in JSR305. If they are not present, a
warning is generated from javac.
@svenreimers
Copy link
Member

Should we create a separate library wrapper jar to for jsr305 and make the commons annotations depend on it? Maybe more modular as a result. If we choose the existing approach a user always needs to depend on the NetBeans abstraction and cannot chose the original library as a dependency. Any thoughts?

@JaroslavTulach
Copy link

The problem with JSR-305 is that it is dormant. It will never become a Java standard and its use of javax. packages may thus be unjustified.

When solving this with Petr Hejl we decided not to expose the JSR-305 annotation during runtime and use those annotations only internally, during compile time.

Copy link

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

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

Spotbugs (the successor of FindBugs) no longer recommends those annotations. As such it may not be the right time to add such dormant project to the NetBeans Platform.

@matthiasblaesing
Copy link
Contributor Author

I'm not sure what to make with this. It is a fact, that the JSR305 classes (or at least the symbols) already leaked out of the module. Javac might have been more forgiving in the past, but it is not anymore.

I see two options:

  • rip the Common Annotations dependency out of the modules and then remove the module altogether and get rid of the annotations
  • update Common Annotations to not carry the JSR305 annotations

One questions remains: Do we gain anything or would it make more sense to keep the library and at least satisfy javac?

@jlahoda
Copy link
Contributor

jlahoda commented Dec 11, 2019

Spotbugs (the successor of FindBugs) no longer recommends those annotations. As such it may not be the right time to add such dormant project to the NetBeans Platform.

If only all was so simple. I did some experiments, and seems SpotBugs still requires the nullness annotations to be meta-annotated using the JSR305 annotations. (Otherwise it simply ignores the annotations.) So, if we remove the meta-annotations, SpotBugs won't work on NetBeans classfiles (not a big deal for me, btw, but I suspect someone would like that to work).

At the same time, I think it makes sense to have @nonnull, etc. annotations, and I agree with Jaroslav that adding jsr305 into the API of the platform does not sound very appealing.

Not sure what is the best way out of this - will try to think about that. In the worst case, we can drop (either manually or at build time) the javax.annotation meta-annotation from our annotations, and accept SpotBugs won't work on NetBeans classfiles.

@gilbertoca
Copy link
Contributor

gilbertoca commented Jan 2, 2020

@matthiasblaesing @geertjanw There is a started work in the https://github.com/eclipse-ee4j/common-annotations-api project to absorb JSR-305 into common-annotations-api project. Maybe a collaborative effort would help?

@matthiasblaesing matthiasblaesing deleted the common_annotations_jsr305 branch October 4, 2021 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants