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 JSpecify annotations to defaults #88

Closed
jvz opened this issue Jan 1, 2024 · 4 comments · Fixed by #95
Closed

Add JSpecify annotations to defaults #88

jvz opened this issue Jan 1, 2024 · 4 comments · Fixed by #95
Assignees
Milestone

Comments

@jvz
Copy link
Member

jvz commented Jan 1, 2024

As noted in https://issues.apache.org/jira/browse/LOG4J2-1477, JSpecify is the project specifying the one true nullability annotation standard. I experimented with creating copies of those annotations that use the JSR 305 nullability annotations to implement it, but it seems like it'd be easier to just use these annotations directly since they're only required at compile time. The use of these annotations would supersede any use of the old JSR annotations.

@ppkarwasz
Copy link
Contributor

@jvz, can you list which tools currently support those annotations? I am mostly interested in Eclipse, IDEA, Spotbugs and some tool like NullAway or Checker Framework that guarantees that the code is NPE-free.

@jvz
Copy link
Member Author

jvz commented Jan 2, 2024

I have no idea if any support this yet. I like the annotation scheme at least, though, if we want to use our own packaged annotations instead based on JSR 305 like I tried out before. That approach at least works with existing tools until JSpecify is directly supported.

@jvz
Copy link
Member Author

jvz commented Jan 2, 2024

I just noticed that this can be done directly in Log4j for now. This will make it simpler to apply any rewrites to the annotations as tooling catches up. See apache/logging-log4j2@2da4108 for the aliasing.

@GregDThomas
Copy link

which tools currently support those annotations? I am mostly interested in Eclipse, IDEA, Spotbugs and some tool like NullAway or Checker Framework t

IntelliJ supports it (JetBrains are a member of the jspecify group - https://jspecify.dev/about)
There's details on a fork of the checker framework at https://github.com/jspecify/jspecify-reference-checker

No idea on Spotbugs/Eclipse I'm afraid.

@ppkarwasz ppkarwasz self-assigned this Jan 9, 2024
ppkarwasz added a commit to ppkarwasz/logging-parent that referenced this issue Jan 10, 2024
This adds [`jspecify`](https://jspecify.dev/) to the dependency
management, a common effort of multiple Java tool developers to provide
a common set of nullability annotations.

Fixes apache#88.
@ppkarwasz ppkarwasz added this to the 10.6.0 milestone Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants