Skip to content

Commit 52f41c6

Browse files
committed
Drop Scala 2.12
- remove 2.12 to 2.13 compatibility classes (RichMap in favor of view.mapValues.toMap, MultiMap in favor of groupBy.view.mapValues.toMap, Stack in favor of mutable.Stack and ArrayBuffer1.reduceToSize1 infavor of ArrayBuffer.dropRightInPlace(length - n)). I thought Stacks were deprecated in 2.13, but mutable.Stacks are available to be used, so I must have made a mistake - replace Implicits/Misc.using with scala.util.Using.resource - remove scala collection compat class - add toOption definition to Maybe* classes - rename toScalaOption to toOption in Maybe class DAFFODIL-2987
1 parent a0d8b86 commit 52f41c6

File tree

63 files changed

+255
-524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+255
-524
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
matrix:
4141
java_distribution: [ temurin ]
4242
java_version: [ 8, 11, 17, 21 ]
43-
scala_version: [ 2.13.16, 2.12.20 ]
43+
scala_version: [ 2.13.16 ]
4444
os: [ ubuntu-22.04, windows-2022, macos-14 ]
4545
exclude:
4646
# only run macos on java 17

DEVELOP.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Daffodil's Java API from Maven or get Daffodil's Scala API from sbt:
281281
```xml
282282
<dependency>
283283
<groupId>org.apache.daffodil</groupId>
284-
<artifactId>daffodil-japi_2.12</artifactId>
284+
<artifactId>daffodil-japi_2.13</artifactId>
285285
<version>3.4.0</version>
286286
</dependency>
287287
```

build.sbt

+1-13
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ lazy val commonSettings = Seq(
239239
organization := "org.apache.daffodil",
240240
version := "4.0.0-SNAPSHOT",
241241
scalaVersion := "2.13.16",
242-
crossScalaVersions := Seq("2.13.16", "2.12.20"),
242+
crossScalaVersions := Seq("2.13.16"),
243243
scalacOptions ++= buildScalacOptions(scalaVersion.value),
244244
Test / scalacOptions ++= buildTestScalacOptions(scalaVersion.value),
245245
Compile / compile / javacOptions ++= buildJavacOptions(),
@@ -282,23 +282,11 @@ def buildScalacOptions(scalaVersion: String) = {
282282
)
283283

284284
val scalaVersionSpecificOptions = CrossVersion.partialVersion(scalaVersion) match {
285-
case Some((2, 12)) =>
286-
Seq(
287-
"-Xfuture",
288-
"-Ywarn-infer-any",
289-
"-Ywarn-inaccessible"
290-
// "-Ywarn-nullary-unit", // we cannot use this. It interferes with the Uniform Access Principle.
291-
// See https://stackoverflow.com/questions/7600910/difference-between-function-with-parentheses-and-without.
292-
)
293285
case Some((2, 13)) =>
294286
Seq(
295287
"-Xlint:inaccessible",
296288
"-Xlint:infer-any",
297289
"-Xlint:nullary-unit",
298-
// TODO: scala 2.12 phase out
299-
// the import is needed for Scala 2.12 but issues an unused import warning under 2.13, so we add this to
300-
// suppresss the warning
301-
"-Wconf:origin=scala.collection.compat.*:s",
302290
// suppress nullary-unit warning in the specific trait
303291
"-Wconf:cat=lint-nullary-unit:silent,site=org.apache.daffodil.junit.tdml.TdmlTests:silent"
304292
)

daffodil-cli/bin.NOTICE

-16
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,3 @@ The following NOTICE information applies to binary components distributed with t
167167
Portions of this code are derived from classes placed in the
168168
public domain by Arbortext on 10 Apr 2000. See:
169169
http://www.arbortext.com/customer_support/updates_and_technical_notes/catalogs/docs/README.htm
170-
171-
- org.scala-lang.scala-collection-compat_2.13-<VERSION>.jar
172-
scala-collection-compat
173-
Copyright (c) 2002-2025 EPFL
174-
Copyright (c) 2011-2025 Lightbend, Inc. dba Akka
175-
176-
Scala includes software developed at
177-
LAMP/EPFL (https://lamp.epfl.ch/) and
178-
Akka (https://akka.io/).
179-
180-
Licensed under the Apache License, Version 2.0 (the "License").
181-
Unless required by applicable law or agreed to in writing, software
182-
distributed under the License is distributed on an "AS IS" BASIS,
183-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
184-
See the License for the specific language governing permissions and
185-
limitations under the License.

daffodil-cli/src/main/scala/org/apache/daffodil/cli/Main.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ import javax.xml.parsers.SAXParserFactory
3535
import javax.xml.transform.TransformerException
3636
import javax.xml.transform.TransformerFactory
3737
import javax.xml.transform.stream.StreamResult
38-
import scala.collection.compat.immutable.ArraySeq
38+
import scala.collection.immutable.ArraySeq
3939
import scala.concurrent.Await
4040
import scala.concurrent.ExecutionContext
4141
import scala.concurrent.Future
4242
import scala.concurrent.duration.Duration
43+
import scala.util.Using
4344
import scala.util.matching.Regex
4445

4546
import org.apache.daffodil.cli.debugger.CLIDebuggerRunner
@@ -49,7 +50,6 @@ import org.apache.daffodil.core.dsom.ExpressionCompilers
4950
import org.apache.daffodil.io.DataDumper
5051
import org.apache.daffodil.io.FormatInfo
5152
import org.apache.daffodil.io.InputSourceDataInputStream
52-
import org.apache.daffodil.lib.Implicits.using
5353
import org.apache.daffodil.lib.api.DaffodilConfig
5454
import org.apache.daffodil.lib.api.DaffodilConfigException
5555
import org.apache.daffodil.lib.api.DaffodilTunables
@@ -1240,7 +1240,7 @@ class Main(
12401240
}
12411241
}
12421242
}
1243-
using(input) { inStream =>
1243+
Using.resource(input) { inStream =>
12441244
val output = parseOpts.output.toOption match {
12451245
case Some("-") | None => STDOUT
12461246
case Some(file) => new FileOutputStream(file)
@@ -1484,7 +1484,7 @@ class Main(
14841484
})
14851485
case Right(bytes) =>
14861486
Timer.getTimeResult({
1487-
using(InputSourceDataInputStream(bytes)) { input =>
1487+
Using.resource(InputSourceDataInputStream(bytes)) { input =>
14881488
val infosetResult =
14891489
infosetHandler.parse(input, nullOutputStreamForParse)
14901490
val parseResult = infosetResult.parseResult

daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/Util.scala

-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ object Util {
8080
.getOrElse(throw new IllegalStateException("No Scala Version found"))
8181

8282
scalaVersion match {
83-
case v if v.startsWith("2.12") => "scala-2.12"
8483
case v if v.startsWith("2.13") => "scala-2.13"
8584
case v if v.startsWith("3.") => "scala-" + v
8685
case _ =>

0 commit comments

Comments
 (0)