JavaLanguageVersion (Gradle API 7.6.4)

Package org.gradle.jvm.toolchain

## Interface JavaLanguageVersion

- All Superinterfaces:
    `java.lang.Comparable<JavaLanguageVersion>`

      public interface JavaLanguageVersion
      extends java.lang.Comparable<JavaLanguageVersion>

  Represents a Java Language version
  Since:
    6.7

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `asInt()` | Return this version as a number, 14 for Java 14.
    `boolean` | `canCompileOrRun​(int otherVersion)` | Indicates if this version can compile or run code based on the passed in language version.
    `boolean` | `canCompileOrRun​(JavaLanguageVersion other)` | Indicates if this version can compile or run code based on the passed in language version.
    `static JavaLanguageVersion` | `of​(int version)` |
    `static JavaLanguageVersion` | `of​(java.lang.String version)` |
    `java.lang.String` | `toString()` | Return this version as a String, "14" for Java 14.

    - ### Methods inherited from interface java.lang.Comparable

      `compareTo`

- - ### Method Detail

    - #### of

          static JavaLanguageVersion of​(int version)

    - #### of

          static JavaLanguageVersion of​(java.lang.String version)

    - #### asInt

          int asInt()

      Return this version as a number, 14 for Java 14.

      Given the type used, this method returns the simple version even for versions lower than 5.

      Returns:
        the version number
      See Also:
        `toString()`

    - #### toString

          java.lang.String toString()

      Return this version as a String, "14" for Java 14.

      This method will return `1.<version>` when the version is lower than 5.

      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the version number
      Since:
        6.8

    - #### canCompileOrRun

          boolean canCompileOrRun​(JavaLanguageVersion other)

      Indicates if this version can compile or run code based on the passed in language version.

      For example, Java 14 can compile or run code from Java 11, but not the opposite.

      Parameters:
        `other` - the language version to check
      Returns:
        `true` if this version can compile or run code from the other version, `false` otherwise

    - #### canCompileOrRun

          boolean canCompileOrRun​(int otherVersion)

      Indicates if this version can compile or run code based on the passed in language version.

      For example, Java 14 can compile or run code from Java 11, but not the opposite.

      Parameters:
        `otherVersion` - the language version to check, as an `int`
      Returns:
        `true` if this version can compile or run code from the other version, `false` otherwise