google / error-prone

Catch common Java mistakes as compile-time errors

Home Page:https://errorprone.info

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

InvalidInlinteTag: @snippet javadoc false positive

xenoterracide opened this issue · comments

warning: [InvalidInlineTag] The tag @snippet is not allowed on this type of element.
   * Converts a checked exception to a {@link RuntimeException} exception.
     ^
    (see https://errorprone.info/bugpattern/InvalidInlineTag)
  Did you mean '*'?

https://openjdk.org/jeps/413

  /**
   * Converts a checked exception to a {@link RuntimeException}.
   * {@snippet :
   * try {
   *   throw new IOException();
   * } catch (Exception e) {
   *   throw ExceptionTools.toRuntime(e);
   * }
   * // Try is from vavr.io
   * Try.of(() -> { throw new IOException(); })
   *    .getOrElseThrow(ExceptionTools::toRuntime);
   *}
   *
   * @param e the exception to convert. {@link NonNull}
   * @return {@link RuntimeException} the converted exception {@link NonNull}
   * @implNote
   * <ul>
   *   <li>{@link IOException} to {@link UncheckedIOException}.</li>
   *   <li>{@link RuntimeException} is returned as is.</li>
   *   <li>Other exceptions are wrapped in a {@link RuntimeException}.</li>
   * </ul>
   * @see <a href="https://docs.vavr.io/#_try">vavr.io Try</a>
   */
  // CHECKSTYLE:OFF: ReturnCount - library to avoid conditional returns and throws elsewhere
  public static @NonNull RuntimeException toRuntime(@NonNull Throwable e) {

EP 2.25.0
Gradle Plugin 3.1.0
Javadoc should use the version with 21, but release is set to 11

java {
  withJavadocJar()
  withSourcesJar()
  toolchain {
    languageVersion.set(JavaLanguageVersion.of(21))
  }
}

tasks.compileJava {
  options.release = 11
}

Also, InvalidInlinteTag could really use more documentation (meaning any at all)