Class ScalaRelease

java.lang.Object
xyz.janboerman.scalaloader.ScalaRelease
All Implemented Interfaces:
Comparable<ScalaRelease>

public final class ScalaRelease extends Object implements Comparable<ScalaRelease>

This class represents a compatibility release version of Scala.

Some constants for commonly used versions of Scala are provided.

Implementation Note:
this class should not be converted into an enum because we want to support the use case of plugin authors to use unsupported and experimental versions of Scala.
  • Field Details

    • VERSION_COMPARATOR

      public static final Comparator<String> VERSION_COMPARATOR
      This comparator compares two version strings that are following the epoch.major.minor version scheme.
    • SCALA_2_12

      public static final ScalaRelease SCALA_2_12
      The Scala 2.12.x series
    • SCALA_2_13

      public static final ScalaRelease SCALA_2_13
      The Scala 2.13.x series
    • SCALA_3_0

      public static final ScalaRelease SCALA_3_0
      The Scala 3.0.x series
    • SCALA_3_1

      public static final ScalaRelease SCALA_3_1
      The Scala 3.1.x series
    • SCALA_3_2

      public static final ScalaRelease SCALA_3_2
      The Scala 3.2.x series
    • SCALA_3_3

      public static final ScalaRelease SCALA_3_3
      The Scala 3.3.x series
    • SCALA_3_4

      public static final ScalaRelease SCALA_3_4
      The Scala 3.4.x series
    • SCALA_3_5

      public static final ScalaRelease SCALA_3_5
      The Scala 3.5.x series
  • Method Details

    • fromScalaVersion

      public static ScalaRelease fromScalaVersion(String scalaVersion)

      Get the ScalaRelease from a Scala version string.

      The Scala version sting is expected to have the compatibility-release as its prefix.

      Parameters:
      scalaVersion - the scala version string
      Returns:
      the ScalaRelease
    • isScala2

      public boolean isScala2()
    • isScala3

      public boolean isScala3()
    • getCompatVersion

      public String getCompatVersion()

      Get the compatibility version of Scala.

      For example, the compatibility version of Scala 2.13.5 would be "2.13".

      Returns:
      the compatibility version
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(ScalaRelease that)
      Specified by:
      compareTo in interface Comparable<ScalaRelease>