remove javax.annotation.meta.When

See original GitHub issue

it appears this is found in the findbugs jsr305 annotations my reason why is I want to enable -Werror and I’m using java modules module-info.java and it appears you can’t use jsr305 as the automatic module name. sadly I don’t actually know what When does or if there’s a replacement. most tools seem to respect annotations named Nullable or NonNull now.

/home/xeno/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.3.8/da9b87dacaa5bbf80fad0f7b483988372a00a152/spring-core-5.3.8.jar(/org/springframework/lang/Nullable.class): warning: Cannot find annotation method 'when()' in type 'Nonnull': class file for javax.annotation.Nonnull not found
warning: unknown enum constant When.MAYBE
  reason: class file for javax.annotation.meta.When not found
error: warnings found and -Werror specified
1 error
2 warnings
❯ ./gradlew --version && ./gradlew :authn:dependencyInsight --configuration runtimeClasspath --dependency spring-core                                                                      # backend -> master + !

------------------------------------------------------------
Gradle 7.1.1
------------------------------------------------------------

Build time:   2021-07-02 12:16:43 UTC
Revision:     774525a055494e0ece39f522ac7ad17498ce032c

Kotlin:       1.4.31
Groovy:       3.0.7
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.11 (AdoptOpenJDK 11.0.11+9)
OS:           Linux 5.10.42-1-MANJARO amd64

Type-safe dependency accessors is an incubating feature.
Type-safe project accessors is an incubating feature.

> Task :authn:dependencyInsight
org.springframework:spring-core:5.3.8

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sdeleuzecommented, Jul 5, 2022

This is a known side effect of current JSR 305 support, the Java compiler generates warning on annotation with enum values when not present in the classpath while it is lenient for the annotations themselves. As suggested by Sam, the workaround is to have the jsr305 in the classpath or module path.

If I am not mistaken, this only occurs when user code is using Spring null-safety annotations, so that’s on purpose that we don’t add jsr305 to the transitive dependencies in a mandatory way.

The middle term fix will be to switch to https://github.com/jspecify/jspecify (where Spring team is involved) and remove those JSR305 annotations from Spring ones.

@sbrannen What about creating an issue dedicated to switching from JSR 305 to JSpecify in the 6.x Backlog in order to give visibility to our users and closing this one?

0reactions
sbrannencommented, Jul 12, 2022
  • Closing as superseded by #28797.
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove javax annotation warnings - Stack Overflow
I'm getting the same warning for @javax.annotation.Generated , but only during a clean build. The second time I build, the warning for ...
Read more >
Remove @javax.annotation.Generated annotation from jOOQ ...
This issue is about removing the annotation from jOOQ code (i.e. jOOQ's internals, including e.g. jOOQ-meta , which contains generated code for ...
Read more >
jsoup 1.14.2 requires javax.annotation version between 3.0 ...
RUNTIME) javax.annotation.meta.TypeQualifierDefault (RetentionPolicy.RUNTIME) So, yes, they are all required at runtime. And they aren't slurped into the jsoup ...
Read more >
javax.annotation-api : 1.3.2 - Maven Central Repository Search
{extension.name} API - Common Annotations for the JavaTM Platform API.
Read more >
javax annotation processing generated - Dr. Chytra V Anand
Generated was deprecated in Java 9 and removed in Java 11. if i use 4.0 works..whats ... Annotations help to associate metadata (information)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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 Reddit Thread

No results found

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