Class RuntimeVersion

java.lang.Object
com.google.errorprone.util.RuntimeVersion

public final class RuntimeVersion extends Object
JDK runtime version utilities.

These methods are generally used when deciding which method to call reflectively. Bug checkers that rely on support for specific source code constructs should consult SourceVersion instead.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Returns true if the current runtime is JDK 12 or newer.
    static boolean
    Returns true if the current runtime is JDK 13 or newer.
    static boolean
    Returns true if the current runtime is JDK 14 or newer.
    static boolean
    Returns true if the current runtime is JDK 15 or newer.
    static boolean
    Returns true if the current runtime is JDK 16 or newer.
    static boolean
    Returns true if the current runtime is JDK 17 or newer.
    static boolean
    Returns true if the current runtime is JDK 18 or newer.
    static boolean
    Returns true if the current runtime is JDK 19 or newer.
    static boolean
    Returns true if the current runtime is JDK 20 or newer.
    static boolean
    Returns true if the current runtime is JDK 21 or newer.
    static int
    Returns the latest --release version.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isAtLeast12

      public static boolean isAtLeast12()
      Returns true if the current runtime is JDK 12 or newer.
    • isAtLeast13

      public static boolean isAtLeast13()
      Returns true if the current runtime is JDK 13 or newer.
    • isAtLeast14

      public static boolean isAtLeast14()
      Returns true if the current runtime is JDK 14 or newer.
    • isAtLeast15

      public static boolean isAtLeast15()
      Returns true if the current runtime is JDK 15 or newer.
    • isAtLeast16

      public static boolean isAtLeast16()
      Returns true if the current runtime is JDK 16 or newer.
    • isAtLeast17

      public static boolean isAtLeast17()
      Returns true if the current runtime is JDK 17 or newer.
    • isAtLeast18

      public static boolean isAtLeast18()
      Returns true if the current runtime is JDK 18 or newer.
    • isAtLeast19

      public static boolean isAtLeast19()
      Returns true if the current runtime is JDK 19 or newer.
    • isAtLeast20

      public static boolean isAtLeast20()
      Returns true if the current runtime is JDK 20 or newer.
    • isAtLeast21

      public static boolean isAtLeast21()
      Returns true if the current runtime is JDK 21 or newer.
    • release

      public static int release()
      Returns the latest --release version.

      Prefer the isAtLeast methods for assumption checks in tests.