Class JavaVersion

java.lang.Object
org.openrewrite.java.marker.JavaVersion
All Implemented Interfaces:
org.openrewrite.marker.Marker

public class JavaVersion extends Object implements org.openrewrite.marker.Marker
  • Constructor Details

    • JavaVersion

      public JavaVersion()
  • Method Details

    • getMajorVersion

      public int getMajorVersion()
    • getMajorReleaseVersion

      public int getMajorReleaseVersion()
      Returns:
      The major --release version.
    • getMajorCreatedByVersion

      public int getMajorCreatedByVersion()
      The major version of the JDK that compiled the sources, parsed from createdBy (typically the java.runtime.version). Unlike getMajorVersion() and getMajorReleaseVersion(), which reflect the -source/--release bytecode level, this reflects the JDK actually performing the compilation. Some features, such as Markdown documentation comments (JEP 467, JDK 23), are recognized based on the compiling JDK regardless of the targeted bytecode level.
      Returns:
      The major version of the compiling JDK, or -1 if it cannot be determined.