rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

JavaDoc rule error annotation @RestrictedApi is missing a default value for the element 'link'

Open vorburger opened this issue 11 months ago • 2 comments

I'm not sure yet where to best file this problem, so I'll start here in bazel-contrib/rules_jvm_external just because "that's where I've encountered it" - fully understanding that the root cause of this may be ... somewhere else, "upstream" - either in Error Prone or Guava or even the JavaDoc tool itself?

If, on https://github.com/enola-dev/enola/ at rev 3ea5b64d2ba5cbd1a9d43b9e521ac9fe0879194f (which isn't on main just yet, but about to be merged as part of https://github.com/enola-dev/enola/pull/1115/) I add "@enola_maven//:com_google_guava_guava" here, and then run bazelisk build //java/dev/enola:javadoc, then it fails with this sort of "interesting" 🤧 error:

/tmp/unpacked-sources16276136151394385243/com/google/common/base/PatternCompiler.java:33: error: annotation @RestrictedApi is missing a default value for the element 'link'
  @RestrictedApi(
  ^
/tmp/unpacked-sources16276136151394385243/com/google/common/base/PatternCompiler.java:42: error: annotation @RestrictedApi is missing a default value for the element 'link'
  @RestrictedApi(

@cushon I thought perhaps this interests you? (Feel absolutely free to just completely totally ignore this!)

vorburger avatar Mar 16 '25 11:03 vorburger

Actually, looking at this leads one here, and noting https://github.com/google/error-prone/commit/9dbf460a76fa4effc0aeb8d51704023a249b3aa1 by @graememorgan ... except that's 2 years old!

Curious why that's being picked up here... (my https://github.com/enola-dev/enola/ project is, generally, fairly up-to-date on dependencies).

vorburger avatar Mar 16 '25 11:03 vorburger

Curious why that's being picked up here...

Running bazelisk build //java/dev/enola:javadoc 2>/tmp/javadoc.txt gives this full log:

javadoc.txt

That includes a whole circus of different versions of Error Prone Annotations! 2.18.0, 2.30.0, 2.36.0 - most several times. With https://github.com/google/error-prone/commit/9dbf460a76fa4effc0aeb8d51704023a249b3aa1 having been fixed in v2.21.0, and 2.18.0 appearing first in the classpath which this javadoc rule passes to the javadoc CLI tool, that explains this error.

But shouldn't the javadoc rule somehow filter out a unique version of each Maven artifact, such as Error Prone Annotations, before it invokes the javadoc CLI tool?

vorburger avatar Mar 16 '25 11:03 vorburger