From e82a37a94f7afb5a227c16f0c0606c997c24b078 Mon Sep 17 00:00:00 2001 From: Philippus Baalman Date: Wed, 23 Jun 2021 01:15:09 +0200 Subject: [PATCH] Update scala 2.13.0 to 2.13.4 (#141) * Extend scala.annotation.Annotation * Supply empty argument list explicitly * Update scala 2.13.0 to 2.13.4 * Update sbt-scoverage to 1.6.1 * Add test for issue #82 --- .travis.yml | 2 +- build.sbt | 10 +++++++- project/plugins.sbt | 2 +- src/main/scala-2.13+/macrocompat/bundle.scala | 2 +- .../ficus/readers/CollectionReaders.scala | 2 +- .../ficus/readers/CollectionReaders.scala | 2 +- .../net/ceedubs/ficus/Issue82Spec.scala | 23 +++++++++++++++++++ 7 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 src/test/scala-2.13+/net/ceedubs/ficus/Issue82Spec.scala diff --git a/.travis.yml b/.travis.yml index 5627249..00708ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ scala: - 2.10.7 - 2.11.12 - 2.12.8 - - 2.13.0 + - 2.13.4 jdk: - oraclejdk8 - openjdk8 diff --git a/build.sbt b/build.sbt index 7d9f4ef..6de722f 100644 --- a/build.sbt +++ b/build.sbt @@ -14,7 +14,7 @@ lazy val project = Project("project", file(".")) description := "A Scala-friendly wrapper companion for Typesafe config", startYear := Some(2013), scalaVersion := "2.12.14", - crossScalaVersions := Seq("2.10.7", "2.11.12", scalaVersion.value, "2.13.0"), + crossScalaVersions := Seq("2.10.7", "2.11.12", scalaVersion.value, "2.13.4"), scalacOptions ++= Seq( "-feature", "-deprecation", @@ -38,6 +38,14 @@ lazy val project = Project("project", file(".")) } } }, + unmanagedSourceDirectories in Test ++= { + (unmanagedSourceDirectories in Test).value.map { dir => + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, 13)) => file(dir.getPath ++ "-2.13+") + case _ => file(dir.getPath ++ "-2.13-") + } + } + }, libraryDependencies ++= (if (scalaVersion.value.startsWith("2.10")) Seq( diff --git a/project/plugins.sbt b/project/plugins.sbt index f1624c8..264de52 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ resolvers += "Typesafe Repository" at "https://repo.typesafe.com/typesafe/releases/" -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7") diff --git a/src/main/scala-2.13+/macrocompat/bundle.scala b/src/main/scala-2.13+/macrocompat/bundle.scala index 3cc6cde..5949dec 100644 --- a/src/main/scala-2.13+/macrocompat/bundle.scala +++ b/src/main/scala-2.13+/macrocompat/bundle.scala @@ -1,3 +1,3 @@ package macrocompat -class bundle +class bundle extends scala.annotation.Annotation diff --git a/src/main/scala-2.13+/net/ceedubs/ficus/readers/CollectionReaders.scala b/src/main/scala-2.13+/net/ceedubs/ficus/readers/CollectionReaders.scala index fcaf525..21f1ca4 100644 --- a/src/main/scala-2.13+/net/ceedubs/ficus/readers/CollectionReaders.scala +++ b/src/main/scala-2.13+/net/ceedubs/ficus/readers/CollectionReaders.scala @@ -20,7 +20,7 @@ trait CollectionReaders { val entryConfig = entry.atPath(DummyPathValue) builder += entryReader.read(entryConfig, DummyPathValue) } - builder.result + builder.result() } } diff --git a/src/main/scala-2.13-/net/ceedubs/ficus/readers/CollectionReaders.scala b/src/main/scala-2.13-/net/ceedubs/ficus/readers/CollectionReaders.scala index 9aad140..548e969 100644 --- a/src/main/scala-2.13-/net/ceedubs/ficus/readers/CollectionReaders.scala +++ b/src/main/scala-2.13-/net/ceedubs/ficus/readers/CollectionReaders.scala @@ -19,7 +19,7 @@ trait CollectionReaders { val entryConfig = entry.atPath(DummyPathValue) builder += entryReader.read(entryConfig, DummyPathValue) } - builder.result + builder.result() } } diff --git a/src/test/scala-2.13+/net/ceedubs/ficus/Issue82Spec.scala b/src/test/scala-2.13+/net/ceedubs/ficus/Issue82Spec.scala new file mode 100644 index 0000000..3a7bd88 --- /dev/null +++ b/src/test/scala-2.13+/net/ceedubs/ficus/Issue82Spec.scala @@ -0,0 +1,23 @@ +package net.ceedubs.ficus + +import net.ceedubs.ficus.Ficus._ +import net.ceedubs.ficus.readers.ArbitraryTypeReader._ +import com.typesafe.config._ +import org.specs2.mutable.Specification + +class Issue82Spec extends Specification { + "Ficus config" should { + "not throw `java.lang.ClassCastException`" in { + case class TestSettings(val `foo-bar`: Long, `foo`: String) + val config = ConfigFactory.parseString("""{ foo-bar: 3, foo: "4" }""") + config.as[TestSettings] must not(throwA[java.lang.ClassCastException]) + } + + """should not assign "foo-bar" to "foo"""" in { + case class TestSettings(val `foo-bar`: String, `foo`: String) + val config = ConfigFactory.parseString("""{ foo-bar: "foo-bar", foo: "foo" }""") + val settings = config.as[TestSettings] + (settings.`foo-bar` mustEqual "foo-bar") and (settings.`foo` mustEqual "foo") + } + } +}