Skip to content

Commit

Permalink
fail hard on EOL Scala 3 minor
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaglin committed Dec 23, 2024
1 parent a18fe12 commit e458763
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 43 deletions.
1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ lazy val interfaces = project
props.put("scala212", scala212)
props.put("scala213", scala213)
props.put("scala33", scala33)
props.put("scala35", scala35)
props.put("scala36", scala36)
props.put("scala3LTS", scala3LTS)
props.put("scala3Next", scala3Next)
Expand Down
1 change: 0 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ object Dependencies {
val scala212 = sys.props.getOrElse("scala212.nightly", "2.12.20")
val scala213 = sys.props.getOrElse("scala213.nightly", "2.13.15")
val scala33 = "3.3.4"
val scala35 = "3.5.2"
val scala36 = "3.6.2"
val scala3LTS = scala33
val scala3Next = sys.props.getOrElse("scala3.nightly", scala36)
Expand Down
2 changes: 0 additions & 2 deletions project/ScalafixBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
scala212,
scala213,
scala33,
scala35,
scala36,
scala3Next
).distinct
Expand Down Expand Up @@ -146,7 +145,6 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
"scala212" -> scala212,
"scala213" -> scala213,
"scala33" -> scala33,
"scala35" -> scala35,
"scala36" -> scala36,
"scala3LTS" -> scala3LTS,
"scala3Next" -> scala3Next,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ final class ScalafixImpl extends Scalafix {
override def scala33(): String =
Versions.scala33
override def scala35(): String =
Versions.scala35
throw new java.lang.UnsupportedOperationException(
"Scala 3.5 is no longer supported; the final version supporting it is Scalafix 0.13.x"
)
override def scala36(): String =
Versions.scala36
override def scala3LTS(): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ public interface Scalafix {
*/
String scala33();

/**
* The Scala 3.5 version in {@link #supportedScalaVersions()}
*/
@Deprecated
String scala35();

/**
Expand Down Expand Up @@ -146,16 +144,16 @@ static Scalafix fetchAndClassloadInstance(String requestedScalaVersion, List<Rep
} else if (requestedScalaMajorMinorOrMajorVersion.equals("2.13") ||
requestedScalaMajorMinorOrMajorVersion.equals("2")) {
scalaVersionKey = "scala213";
} else if (requestedScalaMajorMinorOrMajorVersion.equals("3.0") ||
requestedScalaMajorMinorOrMajorVersion.equals("3.1") ||
requestedScalaMajorMinorOrMajorVersion.equals("3.2") ||
requestedScalaMajorMinorOrMajorVersion.equals("3.3")) {
} else if (requestedScalaMajorMinorOrMajorVersion.equals("3.3")) {
scalaVersionKey = "scala33";
} else if (requestedScalaMajorMinorOrMajorVersion.equals("3.5")) {
scalaVersionKey = "scala35";
} else if (requestedScalaMajorMinorOrMajorVersion.equals("3.6")) {
scalaVersionKey = "scala36";
} else if (requestedScalaMajorMinorOrMajorVersion.startsWith("3")) {
} else if (!requestedScalaMajorMinorOrMajorVersion.equals("3.0") &&
!requestedScalaMajorMinorOrMajorVersion.equals("3.1") &&
!requestedScalaMajorMinorOrMajorVersion.equals("3.2") &&
!requestedScalaMajorMinorOrMajorVersion.equals("3.4") &&
!requestedScalaMajorMinorOrMajorVersion.equals("3.5") &&
requestedScalaMajorMinorOrMajorVersion.startsWith("3")) {
scalaVersionKey = "scala3Next";
} else {
throw new IllegalArgumentException("Unsupported scala version " + requestedScalaVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class ScalafixSuite extends AnyFunSuite {
assert(api.scala212() == Versions.scala212)
assert(api.scala213() == Versions.scala213)
assert(api.scala33() == Versions.scala33)
assert(api.scala35() == Versions.scala35)
assert(api.scala36() == Versions.scala36)
assert(api.scala3LTS() == Versions.scala3LTS)
assert(api.scala3Next() == Versions.scala3Next)
Expand All @@ -57,15 +56,24 @@ class ScalafixSuite extends AnyFunSuite {
assert(help.contains("Usage: scalafix"))
}

test("fail to classload Scala 2.11 with full version") {
test("fail to classload EOL versions") {
assertThrows[IllegalArgumentException](
Scalafix.fetchAndClassloadInstance("2.11.0", repositories)
Scalafix.fetchAndClassloadInstance("2.11", repositories)
)
}

test("fail to classload Scala 2.11 with minor version") {
assertThrows[IllegalArgumentException](
Scalafix.fetchAndClassloadInstance("2.11", repositories)
Scalafix.fetchAndClassloadInstance("3.0", repositories)
)
assertThrows[IllegalArgumentException](
Scalafix.fetchAndClassloadInstance("3.1", repositories)
)
assertThrows[IllegalArgumentException](
Scalafix.fetchAndClassloadInstance("3.2", repositories)
)
assertThrows[IllegalArgumentException](
Scalafix.fetchAndClassloadInstance("3.4", repositories)
)
assertThrows[IllegalArgumentException](
Scalafix.fetchAndClassloadInstance("3.5", repositories)
)
}

Expand Down Expand Up @@ -96,16 +104,6 @@ class ScalafixSuite extends AnyFunSuite {
assert(scalafixAPI.scalaVersion() == Versions.scala213)
}

test("classload Scala 3 LTS with full pre-LTS version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.0.0", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala3LTS)
}

test("classload Scala 3 LTS with major.minor pre-LTS version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.2", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala3LTS)
}

test("classload Scala 3 LTS with full LTS version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.3.4", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala3LTS)
Expand All @@ -116,16 +114,6 @@ class ScalafixSuite extends AnyFunSuite {
assert(scalafixAPI.scalaVersion() == Versions.scala3LTS)
}

test("classload Scala 3.5 with full version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.5.2", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala35)
}

test("classload Scala 3.5 with major.minor version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.5", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala35)
}

test("classload Scala 3 Next with full version") {
val scalafixAPI = Scalafix.fetchAndClassloadInstance("3.6.2", repositories)
assert(scalafixAPI.scalaVersion() == Versions.scala3Next)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class InterfacesPropertiesSuite extends AnyFunSuite with BeforeAndAfterAll {
check("scala212", Versions.scala212)
check("scala213", Versions.scala213)
check("scala33", Versions.scala33)
check("scala35", Versions.scala35)
check("scala36", Versions.scala36)
check("scala3LTS", Versions.scala3LTS)
check("scala3Next", Versions.scala3Next)
Expand Down

0 comments on commit e458763

Please sign in to comment.