This is an automated email from the ASF dual-hosted git repository.
olabusayo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git
The following commit(s) were added to refs/heads/main by this push:
new c9a5f786c Replace Deprecated classes like Stack/Stream
c9a5f786c is described below
commit c9a5f786cee8b084929eba1bd4da092780ebf033
Author: olabusayoT <[email protected]>
AuthorDate: Thu Feb 6 20:28:37 2025 -0500
Replace Deprecated classes like Stack/Stream
- remove TransientParam class, replace with just @transient
- replace deprecated Stream with LazyList
- rename iterator to eventIterator since Iterator trait now defines
iterator field
- .toIterator -> .iterator
- update collection converters for 2.13, add compat class to enable for 2.12
- remove additional implicitCoversions/reflectiveCalls imports since it
causes an unused import error in 2.13
- replace mutable.ArrayStack/Stack with custom Stack class that is backed
by ListBuffer
- replace deprecated Proxy class with overrides to toString, hashCode and
equals
- non-explicit implicit return types are deprecated in 2.13
- parseString is required for 2.13 extenders of Numeric, set to None
- add comments about code not covered by tests
DAFFODIL-2152
---
daffodil-cli/bin.NOTICE | 16 +++
.../daffodil/cli/debugger/CLIDebuggerRunner.scala | 2 +-
.../org/apache/daffodil/cli/cliTest/Util.scala | 2 +-
.../codegen/c/DaffodilCCodeGenerator.scala | 2 +-
.../codegen/c/generators/CodeGeneratorState.scala | 149 +++++++++++----------
.../apache/daffodil/core/layers/TestLayers.scala | 2 +-
.../apache/daffodil/layers/TestJavaIOStreams.scala | 2 +-
.../scala/org/apache/daffodil/japi/Daffodil.scala | 2 +-
.../org/apache/daffodil/example/TestJavaAPI.java | 4 +-
.../scala/org/apache/daffodil/lib/Implicits.scala | 1 -
.../org/apache/daffodil/lib/api/Validator.scala | 2 +-
.../org/apache/daffodil/lib/util/Coroutines.scala | 14 +-
.../apache/daffodil/lib/util/DecimalUtils.scala | 4 +-
.../scala/org/apache/daffodil/lib/util/Misc.scala | 9 +-
.../daffodil/lib/util/NonAllocatingMap.scala | 2 +-
.../org/apache/daffodil/lib/util/OnStack.scala | 11 +-
.../org/apache/daffodil/lib/util/Serialize.scala | 2 +-
.../util/{ScalaAnnotations.scala => Stack.scala} | 47 +++++--
.../scala/org/apache/daffodil/lib/util/Timer.scala | 6 +-
.../daffodil/lib/validation/XercesValidator.scala | 2 +-
.../daffodil/lib/xml/DaffodilXMLLoader.scala | 2 +-
.../org/apache/daffodil/lib/xml/XMLUtils.scala | 2 +-
.../src/main/scala/passera/numerics/package.scala | 26 +++-
.../src/main/scala/passera/unsigned/package.scala | 45 ++++---
.../lib/util/TestXMLCatalogAndValidate.scala | 5 +-
.../runtime1/ChoiceAndOtherVariousUnparsers.scala | 2 +-
.../runtime1/dsom/CompiledExpression1.scala | 5 +-
.../daffodil/runtime1/processors/Evaluatable.scala | 2 +-
.../processors/parsers/ElementKindParsers.scala | 2 +-
.../validation/schematron/SchematronResult.scala | 2 +-
.../daffodil/processor/tdml/TestRunnerFactory.java | 4 +-
project/Dependencies.scala | 6 +-
32 files changed, 237 insertions(+), 147 deletions(-)
diff --git a/daffodil-cli/bin.NOTICE b/daffodil-cli/bin.NOTICE
index 50cdd4295..c30e70644 100644
--- a/daffodil-cli/bin.NOTICE
+++ b/daffodil-cli/bin.NOTICE
@@ -167,3 +167,19 @@ The following NOTICE information applies to binary
components distributed with t
Portions of this code are derived from classes placed in the
public domain by Arbortext on 10 Apr 2000. See:
http://www.arbortext.com/customer_support/updates_and_technical_notes/catalogs/docs/README.htm
+
+- org.scala-lang.scala-collection-compat_2.13-<VERSION>.jar
+ scala-collection-compat
+ Copyright (c) 2002-2025 EPFL
+ Copyright (c) 2011-2025 Lightbend, Inc. dba Akka
+
+ Scala includes software developed at
+ LAMP/EPFL (https://lamp.epfl.ch/) and
+ Akka (https://akka.io/).
+
+ Licensed under the Apache License, Version 2.0 (the "License").
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git
a/daffodil-cli/src/main/scala/org/apache/daffodil/cli/debugger/CLIDebuggerRunner.scala
b/daffodil-cli/src/main/scala/org/apache/daffodil/cli/debugger/CLIDebuggerRunner.scala
index c2014b53d..f5566a41e 100644
---
a/daffodil-cli/src/main/scala/org/apache/daffodil/cli/debugger/CLIDebuggerRunner.scala
+++
b/daffodil-cli/src/main/scala/org/apache/daffodil/cli/debugger/CLIDebuggerRunner.scala
@@ -20,8 +20,8 @@ package org.apache.daffodil.cli.debugger
import java.io.File
import java.io.InputStream
import java.io.PrintStream
-import scala.collection.JavaConverters._
import scala.io.Source
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.runtime1.debugger._
diff --git
a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/Util.scala
b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/Util.scala
index 3dd42d928..3dfd6edd1 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/Util.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/Util.scala
@@ -31,8 +31,8 @@ import java.nio.file.Path
import java.nio.file.Paths
import java.security.MessageDigest
import java.util.concurrent.TimeUnit
-import scala.collection.JavaConverters._
import scala.collection.mutable
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.cli.Main
import org.apache.daffodil.cli.Main.ExitCode
diff --git
a/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala
b/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala
index a42fab04f..80615a292 100644
---
a/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala
+++
b/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala
@@ -21,7 +21,7 @@ import java.io.File
import java.net.JarURLConnection
import java.nio.file.Files
import java.nio.file.Paths
-import scala.collection.JavaConverters._
+import scala.jdk.CollectionConverters._
import scala.util.Properties.isWin
import org.apache.daffodil.codegen.c.generators.AlignmentFillCodeGenerator
diff --git
a/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/generators/CodeGeneratorState.scala
b/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/generators/CodeGeneratorState.scala
index 31a209eac..1e18f45cc 100644
---
a/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/generators/CodeGeneratorState.scala
+++
b/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/generators/CodeGeneratorState.scala
@@ -28,6 +28,7 @@ import org.apache.daffodil.core.dsom.SchemaComponent
import org.apache.daffodil.lib.api.WarnID
import org.apache.daffodil.lib.cookers.ChoiceBranchKeyCooker
import org.apache.daffodil.lib.schema.annotation.props.gen.OccursCountKind
+import org.apache.daffodil.lib.util.Stack
import org.apache.daffodil.runtime1.dpath.NodeInfo.PrimType
/**
@@ -35,7 +36,7 @@ import org.apache.daffodil.runtime1.dpath.NodeInfo.PrimType
*/
class CodeGeneratorState(private val root: ElementBase) {
private val elementsAlreadySeen = mutable.Map[String, ElementBase]()
- private val structs = mutable.Stack[ComplexCGState]()
+ private val structs = new Stack[ComplexCGState]()
private val prototypes = mutable.ArrayBuffer[String]()
private val erds = mutable.ArrayBuffer[String]()
private val finalStructs = mutable.ArrayBuffer[String]()
@@ -45,22 +46,22 @@ class CodeGeneratorState(private val root: ElementBase) {
structs.push(new ComplexCGState(cStructName(root), root))
// Returns true if the generator is currently processing an array
- def hasArray: Boolean = structs.nonEmpty && structs.top.inArray
+ def hasArray: Boolean = structs.nonEmpty && structs.top().inArray
// Returns true if the generator is currently processing a choice
- def hasChoice: Boolean = structs.nonEmpty &&
structs.top.initChoiceStatements.nonEmpty
+ def hasChoice: Boolean = structs.nonEmpty &&
structs.top().initChoiceStatements.nonEmpty
// Starts generating an element
def pushElement(context: ElementBase): Unit = {
// Generate a choice statement case if the element is in a choice element
if (hasChoice) {
val position = context.position
- structs.top.initChoiceStatements ++= ChoiceBranchKeyCooker
+ structs.top().initChoiceStatements ++= ChoiceBranchKeyCooker
.convertConstant(context.choiceBranchKey, context, forUnparse = false)
.map { key => s" case $key:" }
- structs.top.initChoiceStatements += s" instance->_choice =
$position;"
- structs.top.parserStatements += s" case $position:"
- structs.top.unparserStatements += s" case $position:"
+ structs.top().initChoiceStatements += s" instance->_choice =
$position;"
+ structs.top().parserStatements += s" case $position:"
+ structs.top().unparserStatements += s" case $position:"
}
if (context.isComplexType || context == root) {
@@ -68,7 +69,7 @@ class CodeGeneratorState(private val root: ElementBase) {
val C = cStructName(context)
structs.push(new ComplexCGState(C, context))
val erd = erdName(context)
- structs.top.initERDStatements +=
+ structs.top().initERDStatements +=
s""" instance->_base.erd = &$erd;
| instance->_base.parent = parent;""".stripMargin
@@ -77,8 +78,12 @@ class CodeGeneratorState(private val root: ElementBase) {
context.isComplexType && context.maybeFixedLengthInBits.isDefined &&
context.maybeFixedLengthInBits.get > 0
) {
val lengthInBits = context.maybeFixedLengthInBits.get
- structs.top.parserStatements += s" const size_t end_bitPos0b =
pstate->pu.bitPos0b + $lengthInBits;"
- structs.top.unparserStatements += s" const size_t end_bitPos0b =
ustate->pu.bitPos0b + $lengthInBits;"
+ structs
+ .top()
+ .parserStatements += s" const size_t end_bitPos0b =
pstate->pu.bitPos0b + $lengthInBits;"
+ structs
+ .top()
+ .unparserStatements += s" const size_t end_bitPos0b =
ustate->pu.bitPos0b + $lengthInBits;"
}
}
}
@@ -88,11 +93,11 @@ class CodeGeneratorState(private val root: ElementBase) {
if (context.isComplexType) {
// Calculate padding if complex element has an explicit length
if (context.maybeFixedLengthInBits.isDefined &&
context.maybeFixedLengthInBits.get > 0) {
- structs.top.parserStatements +=
+ structs.top().parserStatements +=
s""" parse_alignment_bits(end_bitPos0b, pstate);
| if (pstate->pu.error) return;""".stripMargin
val octalFillByte = context.fillByteEv.constValue.toByte.toOctalString
- structs.top.unparserStatements +=
+ structs.top().unparserStatements +=
s""" unparse_alignment_bits(end_bitPos0b, '\\$octalFillByte',
ustate);
| if (ustate->pu.error) return;""".stripMargin
}
@@ -113,13 +118,17 @@ class CodeGeneratorState(private val root: ElementBase) {
val e = cName(context)
val deref = if (hasArray) "[i]" else ""
if (hasChoice)
- structs.top.initChoiceStatements += s"$indent2
${C}_initERD(&instance->$e$deref, (InfosetBase *)instance);"
+ structs
+ .top()
+ .initChoiceStatements += s"$indent2
${C}_initERD(&instance->$e$deref, (InfosetBase *)instance);"
else
- structs.top.initERDStatements += s"$indent2
${C}_initERD(&instance->$e$deref, (InfosetBase *)instance);"
- structs.top.parserStatements +=
+ structs
+ .top()
+ .initERDStatements += s"$indent2
${C}_initERD(&instance->$e$deref, (InfosetBase *)instance);"
+ structs.top().parserStatements +=
s"""$indent1$indent2 ${C}_parseSelf(&instance->$e$deref, pstate);
|$indent1$indent2 if (pstate->pu.error) return;""".stripMargin
- structs.top.unparserStatements +=
+ structs.top().unparserStatements +=
s"""$indent1$indent2 ${C}_unparseSelf(&instance->$e$deref, ustate);
|$indent1$indent2 if (ustate->pu.error) return;""".stripMargin
} else if (context == root) {
@@ -144,15 +153,15 @@ class CodeGeneratorState(private val root: ElementBase) {
// Generate a choice statement break if the child is in a choice element
if (hasChoice) {
val break = s" break;"
- structs.top.initChoiceStatements += break
- structs.top.parserStatements += break
- structs.top.unparserStatements += break
+ structs.top().initChoiceStatements += break
+ structs.top().parserStatements += break
+ structs.top().unparserStatements += break
}
}
// Starts generating a reoccurring element (array element)
def pushArray(context: SchemaComponent): Unit = {
- val C = structs.top.C
+ val C = structs.top().C
val e = context.asInstanceOf[ElementBase]
structs.push(new ComplexCGState(C, e, inArray = true))
}
@@ -161,7 +170,7 @@ class CodeGeneratorState(private val root: ElementBase) {
def popArray(context: SchemaComponent): Unit = {
// Finish generating array element
val e = context.asInstanceOf[ElementBase]
- val C = structs.top.C
+ val C = structs.top().C
val arrayName = s"array_${cStructName(e)}$C"
// Prevent redundant definitions on reused types
if (elementNotSeenYet(e, arrayName)) {
@@ -169,31 +178,34 @@ class CodeGeneratorState(private val root: ElementBase) {
}
// Link parent element to array element
- val declarations = structs.top.declarations
- val offsetComputations = structs.top.offsetComputations
- val erdComputations = structs.top.erdComputations
+ val declarations = structs.top().declarations
+ val offsetComputations = structs.top().offsetComputations
+ val erdComputations = structs.top().erdComputations
structs.pop()
- structs.top.declarations ++= declarations
- structs.top.offsetComputations ++= offsetComputations
- structs.top.erdComputations ++= erdComputations
+ structs.top().declarations ++= declarations
+ structs.top().offsetComputations ++= offsetComputations
+ structs.top().erdComputations ++= erdComputations
// Now call the array's methods instead of the array's element's methods
val indent = if (hasChoice) INDENT else NO_INDENT
if (hasChoice)
- structs.top.initChoiceStatements += s"$indent
${arrayName}_initERD(instance, parent);"
+ structs
+ .top()
+ // TODO: not covered by tests
+ .initChoiceStatements += s"$indent ${arrayName}_initERD(instance,
parent);"
else
- structs.top.initERDStatements += s"$indent
${arrayName}_initERD(instance, parent);"
- structs.top.parserStatements +=
+ structs.top().initERDStatements += s"$indent
${arrayName}_initERD(instance, parent);"
+ structs.top().parserStatements +=
s"""$indent ${arrayName}_parseSelf(instance, pstate);
|$indent if (pstate->pu.error) return;""".stripMargin
- structs.top.unparserStatements +=
+ structs.top().unparserStatements +=
s"""$indent ${arrayName}_unparseSelf(instance, ustate);
|$indent if (ustate->pu.error) return;""".stripMargin
}
// Generates choice member/ERD and switch statements for a choice group
def addBeforeSwitchStatements(): Unit = {
- val context = structs.top.context
+ val context = structs.top().context
val erd = erdName(context)
val dispatchField = choiceDispatchField(context)
if (dispatchField.nonEmpty) {
@@ -243,12 +255,12 @@ class CodeGeneratorState(private val root: ElementBase) {
if (elementNotSeenYet(context, erd)) {
erds += erdDef
}
- structs.top.declarations += declaration
- structs.top.offsetComputations += offsetComputation
- structs.top.erdComputations += erdComputation
- structs.top.initChoiceStatements += initChoiceStatement
- structs.top.parserStatements += parseStatement
- structs.top.unparserStatements += unparseStatement
+ structs.top().declarations += declaration
+ structs.top().offsetComputations += offsetComputation
+ structs.top().erdComputations += erdComputation
+ structs.top().initChoiceStatements += initChoiceStatement
+ structs.top().parserStatements += parseStatement
+ structs.top().unparserStatements += unparseStatement
}
}
@@ -278,10 +290,10 @@ class CodeGeneratorState(private val root: ElementBase) {
| return;
| }""".stripMargin
- structs.top.declarations += declaration
- structs.top.initChoiceStatements += initChoiceStatement
- structs.top.parserStatements += parseStatement
- structs.top.unparserStatements += unparseStatement
+ structs.top().declarations += declaration
+ structs.top().initChoiceStatements += initChoiceStatement
+ structs.top().parserStatements += parseStatement
+ structs.top().unparserStatements += unparseStatement
}
}
@@ -293,12 +305,13 @@ class CodeGeneratorState(private val root: ElementBase) {
): Unit = {
if (initERDStatement.nonEmpty) {
if (hasChoice)
- structs.top.initChoiceStatements += initERDStatement
+ // TODO: not covered by tests
+ structs.top().initChoiceStatements += initERDStatement
else
- structs.top.initERDStatements += initERDStatement
+ structs.top().initERDStatements += initERDStatement
}
- if (parseStatement.nonEmpty) structs.top.parserStatements += parseStatement
- if (unparseStatement.nonEmpty) structs.top.unparserStatements +=
unparseStatement
+ if (parseStatement.nonEmpty) structs.top().parserStatements +=
parseStatement
+ if (unparseStatement.nonEmpty) structs.top().unparserStatements +=
unparseStatement
}
// Generates a C header to define the Daffodil version
@@ -474,9 +487,9 @@ class CodeGeneratorState(private val root: ElementBase) {
private def addComplexTypeERD(context: ElementBase): Unit = {
val C = cStructName(context)
val erd = erdName(context)
- val count = structs.top.offsetComputations.length
- val offsetComputations = structs.top.offsetComputations.mkString(",\n")
- val erdComputations = structs.top.erdComputations.mkString(",\n")
+ val count = structs.top().offsetComputations.length
+ val offsetComputations = structs.top().offsetComputations.mkString(",\n")
+ val erdComputations = structs.top().erdComputations.mkString(",\n")
val qNameInit = defineQNameInit(context)
val numChildren = if (hasChoice) 2 else count
val initChoice = if (hasChoice) s"(InitChoiceRD)&${C}_initChoice" else
"NULL"
@@ -522,7 +535,7 @@ class CodeGeneratorState(private val root: ElementBase) {
// Adds a C struct definition for the given complex element
private def addStruct(context: ElementBase): Unit = {
val C = cStructName(context)
- val declarations = structs.top.declarations.mkString("\n")
+ val declarations = structs.top().declarations.mkString("\n")
val struct =
s"""typedef struct $C
|{
@@ -537,18 +550,18 @@ class CodeGeneratorState(private val root: ElementBase) {
// Generates a complex element's initERD, parseSelf, unparseSelf functions
private def addImplementation(context: ElementBase): Unit = {
val C = cStructName(context)
- val initERDStatements = structs.top.initERDStatements.mkString("\n")
- val initChoiceStatements = structs.top.initChoiceStatements.mkString("\n")
+ val initERDStatements = structs.top().initERDStatements.mkString("\n")
+ val initChoiceStatements =
structs.top().initChoiceStatements.mkString("\n")
val parserStatements =
- if (structs.top.parserStatements.nonEmpty)
- structs.top.parserStatements.mkString("\n")
+ if (structs.top().parserStatements.nonEmpty)
+ structs.top().parserStatements.mkString("\n")
else
s""" // Empty struct, but need to prevent compiler warnings
| UNUSED(instance);
| UNUSED(pstate);""".stripMargin
val unparserStatements =
- if (structs.top.unparserStatements.nonEmpty)
- structs.top.unparserStatements.mkString("\n")
+ if (structs.top().unparserStatements.nonEmpty)
+ structs.top().unparserStatements.mkString("\n")
else
s""" // Empty struct, but need to prevent compiler warnings
| UNUSED(instance);
@@ -609,8 +622,8 @@ class CodeGeneratorState(private val root: ElementBase) {
private def addSimpleTypeERD(context: ElementBase): Unit = {
val C = cStructName(context)
val erd = erdName(context)
- val count = structs.top.offsetComputations.length
- val offsetComputations = structs.top.offsetComputations.mkString(",\n")
+ val count = structs.top().offsetComputations.length
+ val offsetComputations = structs.top().offsetComputations.mkString(",\n")
val qNameInit = defineQNameInit(context)
val typeCode = getPrimType(context) match {
case PrimType.Boolean => "PRIMITIVE_BOOLEAN"
@@ -685,7 +698,7 @@ class CodeGeneratorState(private val root: ElementBase) {
val indent = if (hasChoice) INDENT else NO_INDENT
val declaration = s"$indent $definition $e$arrayDef;"
- structs.top.declarations += declaration
+ structs.top().declarations += declaration
// Add an array member to store a fixed length hexBinary element if needed
if (
@@ -694,13 +707,13 @@ class CodeGeneratorState(private val root: ElementBase) {
) {
val fixedLength = child.maybeFixedLengthInBits.get / 8
val declaration2 = s"$indent uint8_t
_a_$e$arrayDef[$fixedLength];"
- structs.top.declarations += declaration2
+ structs.top().declarations += declaration2
}
}
// Adds an element's ERD & offset to its parent element's children ERD &
offset computations.
private def addComputations(child: ElementBase): Unit = {
- val C = structs.top.C
+ val C = structs.top().C
val e = cName(child)
val hasArray = arrayMaxOccurs(child) > 0
val arrayName = s"array_${cStructName(child)}$C"
@@ -709,13 +722,13 @@ class CodeGeneratorState(private val root: ElementBase) {
val offsetComputation =
s" (const char *)&${C}_compute_offsets.$e$deref - (const char
*)&${C}_compute_offsets"
val erdComputation = s" &$erd"
- structs.top.offsetComputations += offsetComputation
- structs.top.erdComputations += erdComputation
+ structs.top().offsetComputations += offsetComputation
+ structs.top().erdComputations += erdComputation
}
// Generates an array's ERD, childrenOffsets, childrenERDs, initERD,
parseSelf, unparseSelf, getArraySize
private def addArrayImplementation(elem: ElementBase): Unit = {
- val C = structs.top.C
+ val C = structs.top().C
val e = cName(elem)
val arrayName = s"array_${cStructName(elem)}$C"
val erd = erdName(elem)
@@ -750,11 +763,11 @@ class CodeGeneratorState(private val root: ElementBase) {
// Add the array's initERD, parseSelf, unparseSelf, getArraySize functions
val initERDStatements =
- if (structs.top.initERDStatements.nonEmpty)
+ if (structs.top().initERDStatements.nonEmpty)
s""" UNUSED(parent);
| for (size_t i = 0; i < $maxOccurs; i++)
| {
- |${structs.top.initERDStatements.mkString("\n")}
+ |${structs.top().initERDStatements.mkString("\n")}
| }""".stripMargin
else
s""" UNUSED(instance);
@@ -766,7 +779,7 @@ class CodeGeneratorState(private val root: ElementBase) {
|
| for (size_t i = 0; i < arraySize; i++)
| {
- |${structs.top.parserStatements.mkString("\n")}
+ |${structs.top().parserStatements.mkString("\n")}
| }""".stripMargin
val unparserStatements =
s""" const size_t arraySize = ${arrayName}_getArraySize(instance);
@@ -775,7 +788,7 @@ class CodeGeneratorState(private val root: ElementBase) {
|
| for (size_t i = 0; i < arraySize; i++)
| {
- |${structs.top.unparserStatements.mkString("\n")}
+ |${structs.top().unparserStatements.mkString("\n")}
| }""".stripMargin
val arraySizeStatements = getOccursCount(elem)
diff --git
a/daffodil-core/src/test/scala/org/apache/daffodil/core/layers/TestLayers.scala
b/daffodil-core/src/test/scala/org/apache/daffodil/core/layers/TestLayers.scala
index 302fe3fbd..cf1d420d9 100644
---
a/daffodil-core/src/test/scala/org/apache/daffodil/core/layers/TestLayers.scala
+++
b/daffodil-core/src/test/scala/org/apache/daffodil/core/layers/TestLayers.scala
@@ -21,7 +21,7 @@ import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.InputStreamReader
import java.nio.charset.StandardCharsets
-import scala.collection.JavaConverters._
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.core.util.TestUtils
import org.apache.daffodil.lib.util._
diff --git
a/daffodil-io/src/test/scala/org/apache/daffodil/layers/TestJavaIOStreams.scala
b/daffodil-io/src/test/scala/org/apache/daffodil/layers/TestJavaIOStreams.scala
index f7f804832..bfea8b6ab 100644
---
a/daffodil-io/src/test/scala/org/apache/daffodil/layers/TestJavaIOStreams.scala
+++
b/daffodil-io/src/test/scala/org/apache/daffodil/layers/TestJavaIOStreams.scala
@@ -22,10 +22,10 @@ import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.nio.charset.StandardCharsets
import java.util.Scanner
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.lib.exceptions.Assert
-import collection.JavaConverters._
import org.apache.commons.io.IOUtils
import org.junit.Assert._
import org.junit.Test
diff --git
a/daffodil-japi/src/main/scala/org/apache/daffodil/japi/Daffodil.scala
b/daffodil-japi/src/main/scala/org/apache/daffodil/japi/Daffodil.scala
index 4114e91a0..c6f1a1c58 100644
--- a/daffodil-japi/src/main/scala/org/apache/daffodil/japi/Daffodil.scala
+++ b/daffodil-japi/src/main/scala/org/apache/daffodil/japi/Daffodil.scala
@@ -21,7 +21,7 @@ import java.io.File
import java.net.URI
import java.nio.channels.ReadableByteChannel
import java.nio.channels.WritableByteChannel
-import scala.collection.JavaConverters._
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.core.compiler.{ Compiler => SCompiler }
import org.apache.daffodil.core.compiler.{ InvalidParserException =>
SInvalidParserException }
diff --git
a/daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
b/daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
index 6ef3e303a..40bd5edd0 100644
--- a/daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
+++ b/daffodil-japi/src/test/java/org/apache/daffodil/example/TestJavaAPI.java
@@ -39,7 +39,7 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import scala.collection.JavaConverters;
+import scala.jdk.javaapi.CollectionConverters;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
@@ -1357,7 +1357,7 @@ public class TestJavaAPI {
output.setBlobAttributes(blobDir, "pre-", ".suf");
ParseResult res = dp.parse(input, output);
- List<Path> blobPaths =
JavaConverters.seqAsJavaList(output.getBlobPaths());
+ List<Path> blobPaths =
CollectionConverters.asJava(output.getBlobPaths());
try {
assertFalse(res.isError());
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/Implicits.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/Implicits.scala
index 3d07e4ee0..4be562f6d 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/Implicits.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/Implicits.scala
@@ -20,7 +20,6 @@ package org.apache.daffodil.lib
import java.io.{ BufferedInputStream, ByteArrayInputStream }
import scala.language.implicitConversions
import scala.language.reflectiveCalls
-import scala.language.{ implicitConversions, reflectiveCalls } // silences
scala 2.10 warnings
import org.apache.daffodil.lib.exceptions.Assert
import org.apache.daffodil.lib.xml.NS
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/api/Validator.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/api/Validator.scala
index 3e3a8f327..da1b0c218 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/api/Validator.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/api/Validator.scala
@@ -69,7 +69,7 @@ object ValidationResult {
val empty: ValidationResult = ValidationResult(Seq.empty, Seq.empty)
def apply(w: Seq[ValidationWarning], e: Seq[ValidationFailure]):
ValidationResult = {
- import scala.collection.JavaConverters.asJavaCollectionConverter
+ import scala.jdk.CollectionConverters._
new ValidationResult {
val warnings: java.util.Collection[ValidationWarning] =
w.asJavaCollection
val errors: java.util.Collection[ValidationFailure] = e.asJavaCollection
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Coroutines.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Coroutines.scala
index 6c5e91d97..09341599b 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Coroutines.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Coroutines.scala
@@ -19,6 +19,7 @@ package org.apache.daffodil.lib.util
import java.util.concurrent.ArrayBlockingQueue
import java.util.concurrent.Executors
+import scala.collection.compat.immutable.LazyList
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.util.Failure
@@ -212,13 +213,14 @@ final class InvertControl[S](body: => Unit) extends
MainCoroutine[Try[S]] with I
private val dummy: Try[S] = Success(null.asInstanceOf[S])
- private def gen: Stream[S] = {
+ private def gen: LazyList[S] = {
val x = resume(
producer,
dummy
) // producer isn't sent anything. It's just resumed to get another value.
x match {
- case EndOfData => Stream.Empty
+ // TODO: no test coverage
+ case EndOfData => LazyList.empty
case Success(v) => v #:: gen
case Failure(e) => {
failed = true
@@ -227,14 +229,16 @@ final class InvertControl[S](body: => Unit) extends
MainCoroutine[Try[S]] with I
}
}
- private lazy val iterator = gen.toIterator
+ private lazy val eventIterator = gen.iterator
override def hasNext: Boolean = {
- !failed && iterator.hasNext
+ // TODO: no test coverage
+ !failed && eventIterator.hasNext
}
override def next(): S = {
if (failed) throw new IllegalStateException()
- else iterator.next()
+ // TODO: no test coverage
+ else eventIterator.next()
}
}
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/DecimalUtils.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/DecimalUtils.scala
index dfeee33e9..edec8415c 100644
---
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/DecimalUtils.scala
+++
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/DecimalUtils.scala
@@ -553,7 +553,7 @@ object DecimalUtils {
}
val allDigits = opl match {
- case OverpunchLocation.Start => digit + num.substring(1)
+ case OverpunchLocation.Start => digit.toString + num.substring(1)
case OverpunchLocation.End => num.substring(0, opindex) + digit
case _ => Assert.impossible()
}
@@ -603,7 +603,7 @@ object DecimalUtils {
}
val convertedNum = opl match {
- case OverpunchLocation.Start => digit + inStr.substring(1)
+ case OverpunchLocation.Start => digit +: inStr.substring(1)
case OverpunchLocation.End => inStr.substring(0, opindex) + digit
case _ => Assert.impossible()
}
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Misc.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Misc.scala
index 0ab579a0d..7679f0be2 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Misc.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Misc.scala
@@ -32,8 +32,8 @@ import java.nio.charset.StandardCharsets
import java.nio.charset.{ Charset => JavaCharset }
import java.nio.file.Files
import java.nio.file.Paths
-import scala.collection.JavaConverters._
import scala.io.Source
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.lib.equality._
import org.apache.daffodil.lib.exceptions.Assert
@@ -272,8 +272,9 @@ object Misc {
}
}
- def initialUpperCase(s: String): String = s.head.toUpper + s.substring(1)
- def initialLowerCase(s: String): String = s.head.toLower + s.substring(1)
+ // TODO: no test coverage
+ def initialUpperCase(s: String): String = s.head.toUpper +: s.substring(1)
+ def initialLowerCase(s: String): String = s.head.toLower +: s.substring(1)
/**
* Convert FooBar to fooBar, but leave FOOBAR as FOOBAR.
@@ -284,7 +285,7 @@ object Misc {
// At this point we know the first letter is uppercase
//
if (isAllUpper(s, 1)) s
- else s(0).toLower + s.substring(1)
+ else s(0).toLower +: s.substring(1)
}
def isAllUpper(s: String, start: Int): Boolean = {
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/NonAllocatingMap.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/NonAllocatingMap.scala
index 1dae020cb..6f08826a5 100644
---
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/NonAllocatingMap.scala
+++
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/NonAllocatingMap.scala
@@ -17,8 +17,8 @@
package org.apache.daffodil.lib.util
-import scala.collection.JavaConverters._
import scala.collection.mutable
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.lib.exceptions.Assert
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/OnStack.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/OnStack.scala
index 067c20c1b..1ddb98804 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/OnStack.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/OnStack.scala
@@ -18,11 +18,10 @@
package org.apache.daffodil.lib.util
import java.util.regex.Matcher
-import scala.collection.mutable
sealed abstract class LocalStackBase[T](constructorFunc: => T,
optionalResetFunc: (T => Unit)) {
- protected def stack: mutable.ArrayStack[T]
+ protected def stack: Stack[T]
/**
* This must be inlined to achieve what we're trying to achieve with
OnStack/LocalStack.
@@ -61,9 +60,9 @@ class OnStack[T](constructorFunc: => T, optionalResetFunc: (T
=> Unit))
*/
def this(constructorFunc: => T) = this(constructorFunc, x => {})
- private val tl = new ThreadLocal[mutable.ArrayStack[T]] {
- protected final override def initialValue(): mutable.ArrayStack[T] = {
- val stack = new mutable.ArrayStack[T]
+ private val tl = new ThreadLocal[Stack[T]] {
+ protected final override def initialValue(): Stack[T] = {
+ val stack = new Stack[T]
stack
}
}
@@ -94,7 +93,7 @@ class LocalStack[T](constructorFunc: => T, optionalResetFunc:
(T => Unit))
*/
def this(constructorFunc: => T) = this(constructorFunc, x => {})
- final protected val stack = new mutable.ArrayStack[T]
+ final protected val stack = new Stack[T]
}
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Serialize.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Serialize.scala
index 01218f44f..053ada106 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Serialize.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Serialize.scala
@@ -17,8 +17,8 @@
package org.apache.daffodil.lib.util
-import scala.collection.JavaConverters._
import scala.collection.mutable.HashMap
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.lib.exceptions.Assert
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/ScalaAnnotations.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Stack.scala
similarity index 52%
rename from
daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/ScalaAnnotations.scala
rename to daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Stack.scala
index 8b154c18c..adaad73bb 100644
---
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/ScalaAnnotations.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Stack.scala
@@ -17,11 +17,42 @@
package org.apache.daffodil.lib.util
-import scala.annotation.meta._
-
-// The @transient annotation on a constructor parameter doesn't work properly
-// in scala >= 2.11, this is because it does not include the @param annotation.
-// This custom annotation extends transient, but adds the @param annotation so
-// construcutor parameters are properly made transient
-@param
-class TransientParam extends scala.transient
+import scala.collection.mutable.ListBuffer
+
+/**
+ * Compatibility class for 2.12 and 2.13 since ArrayStack and Stack
+ * have been deprecated in 2.13. This allows us to maintain the same
+ * functionality as stack while using ListBuffer instead
+ */
+class Stack[T] {
+ def apply(index: Int): T = {
+ _stackLike(index)
+ }
+
+ private val _stackLike: ListBuffer[T] = new ListBuffer[T]
+
+ def pop(): T = {
+ _stackLike.remove(_stackLike.length - 1)
+ }
+
+ def push(item: T): Unit = {
+ _stackLike += item
+ }
+
+ def isEmpty: Boolean = {
+ _stackLike.isEmpty
+ }
+
+ def clear(): Unit = {
+ // TODO: not covered by tests
+ _stackLike.clear()
+ }
+
+ def top(): T = {
+ _stackLike.last
+ }
+
+ def nonEmpty: Boolean = {
+ _stackLike.nonEmpty
+ }
+}
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Timer.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Timer.scala
index b1cf1a15d..f38fdc717 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Timer.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Timer.scala
@@ -17,7 +17,7 @@
package org.apache.daffodil.lib.util
-import scala.collection.JavaConverters._
+import scala.jdk.CollectionConverters._
object Timer {
@@ -185,8 +185,10 @@ object TimeTracker {
* necessary since we often want to track the time each parser takes to
* complete, but our parsers are nested making that difficult with standard
* profilers. This makes that much easier.
+ *
+ * TODO: not covered by tests
*/
- val childrenTimeStack = scala.collection.mutable.Stack[Long]()
+ val childrenTimeStack = new org.apache.daffodil.lib.util.Stack[Long]()
/**
* Used to measure a section of code that might get called multiple times.
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/validation/XercesValidator.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/validation/XercesValidator.scala
index 076a7d387..414b7618c 100644
---
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/validation/XercesValidator.scala
+++
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/validation/XercesValidator.scala
@@ -20,7 +20,7 @@ package org.apache.daffodil.lib.validation
import java.net.URI
import javax.xml.XMLConstants
import javax.xml.transform.stream.StreamSource
-import scala.collection.JavaConverters._
+import scala.jdk.CollectionConverters._
import scala.xml.SAXException
import org.apache.daffodil.lib.api.ValidationException
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/DaffodilXMLLoader.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/DaffodilXMLLoader.scala
index dd876c736..b8801d497 100644
---
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/DaffodilXMLLoader.scala
+++
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/DaffodilXMLLoader.scala
@@ -35,7 +35,7 @@ import javax.xml.transform.sax.SAXSource
import javax.xml.transform.stream.StreamSource
import javax.xml.validation.Schema
import javax.xml.validation.SchemaFactory
-import scala.collection.JavaConverters.asScalaBufferConverter
+import scala.jdk.CollectionConverters._
import scala.xml.SAXParseException
import scala.xml.SAXParser
import scala.xml.parsing.NoBindingFactoryAdapter
diff --git
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala
index 2865455d5..6c4ae2dad 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala
@@ -282,7 +282,7 @@ object XMLUtils {
}
// we fell out of the loop. So
processText() // in case there is text left pending when we hit the end
- ab.result()
+ ab.result().toSeq
}
val XSD_NAMESPACE = NS(
diff --git a/daffodil-lib/src/main/scala/passera/numerics/package.scala
b/daffodil-lib/src/main/scala/passera/numerics/package.scala
index 5753305c0..bdc646f3a 100644
--- a/daffodil-lib/src/main/scala/passera/numerics/package.scala
+++ b/daffodil-lib/src/main/scala/passera/numerics/package.scala
@@ -30,16 +30,16 @@ import scala.language.implicitConversions
package object numerics {
implicit def toRicherInt(x: Int): RicherInt = new RicherInt(x)
- implicit def toRicherInt(x: scala.runtime.RichInt) = new YetRicherInt(
+ implicit def toRicherInt(x: scala.runtime.RichInt): YetRicherInt = new
YetRicherInt(
x.self.asInstanceOf[Int]
)
implicit def toRicherLong(x: Long): RicherLong = new RicherLong(x)
- implicit def toRicherLong(x: scala.runtime.RichLong) = new YetRicherLong(
+ implicit def toRicherLong(x: scala.runtime.RichLong): YetRicherLong = new
YetRicherLong(
x.self.asInstanceOf[Long]
)
- class RicherInt(x: Int) extends Proxy {
+ class RicherInt(x: Int) {
def self: Any = x
import java.lang.Integer
@@ -58,17 +58,24 @@ package object numerics {
def <<@(dist: Int) = rotateLeft(dist)
def >>@(dist: Int) = rotateRight(dist)
+
+ override def equals(obj: Any): Boolean = super.equals(obj)
+ override def toString: String = super.toString
+ override def hashCode(): Int = super.hashCode()
}
- class YetRicherInt(x: Int) extends Proxy {
+ class YetRicherInt(x: Int) {
def self: Any = x
def to(y: Long, step: Long = 1L) = x.toLong to y by step
def until(y: Long, step: Long = 1L) = x.toLong until y by step
def max(y: Long) = x.toLong.max(y)
def min(y: Long) = x.toLong.min(y)
+ override def equals(obj: Any): Boolean = super.equals(obj)
+ override def toString: String = super.toString
+ override def hashCode(): Int = super.hashCode()
}
- class RicherLong(x: Long) extends Proxy {
+ class RicherLong(x: Long) {
def self: Any = x
import java.lang.Long
@@ -87,9 +94,16 @@ package object numerics {
def <<@(dist: Int) = rotateLeft(dist)
def >>@(dist: Int) = rotateRight(dist)
+
+ override def equals(obj: Any): Boolean = super.equals(obj)
+ override def toString: String = super.toString
+ override def hashCode(): Int = super.hashCode()
}
- class YetRicherLong(x: Long) extends Proxy {
+ class YetRicherLong(x: Long) {
def self: Any = x
+ override def equals(obj: Any): Boolean = super.equals(obj)
+ override def toString: String = super.toString
+ override def hashCode(): Int = super.hashCode()
}
}
diff --git a/daffodil-lib/src/main/scala/passera/unsigned/package.scala
b/daffodil-lib/src/main/scala/passera/unsigned/package.scala
index a98e34e97..bcf2fcb12 100644
--- a/daffodil-lib/src/main/scala/passera/unsigned/package.scala
+++ b/daffodil-lib/src/main/scala/passera/unsigned/package.scala
@@ -29,21 +29,22 @@ package passera
import scala.language.implicitConversions
package object unsigned {
- implicit def ubyte2uint(x: UByte) = UInt(x.toInt)
- implicit def ushort2uint(x: UShort) = UInt(x.toInt)
- implicit def ubyte2ulong(x: UByte) = ULong(x.toLong)
- implicit def ushort2ulong(x: UShort) = ULong(x.toLong)
- implicit def uint2ulong(x: UInt) = ULong(x.toLong)
+ implicit def ubyte2uint(x: UByte): UInt = UInt(x.toInt)
+ implicit def ushort2uint(x: UShort): UInt = UInt(x.toInt)
+ implicit def ubyte2ulong(x: UByte): ULong = ULong(x.toLong)
+ implicit def ushort2ulong(x: UShort): ULong = ULong(x.toLong)
+ implicit def uint2ulong(x: UInt): ULong = ULong(x.toLong)
- implicit def signedIntOps(x: Int) = new SignedIntOps(x)
- implicit def signedLongOps(x: Long) = new SignedLongOps(x)
- implicit def floatOps(x: Float) = new FloatOps(x)
- implicit def doubleOps(x: Double) = new DoubleOps(x)
- implicit def signedRichIntOps(x: scala.runtime.RichInt) = new
SignedRichIntOps(
- x.self.asInstanceOf[Int]
- )
- implicit def richUInt(x: UInt) = new RichUInt(x)
- implicit def richerUInt(x: UInt) = new RicherUInt(x.toInt)
+ implicit def signedIntOps(x: Int): SignedIntOps = new SignedIntOps(x)
+ implicit def signedLongOps(x: Long): SignedLongOps = new SignedLongOps(x)
+ implicit def floatOps(x: Float): FloatOps = new FloatOps(x)
+ implicit def doubleOps(x: Double): DoubleOps = new DoubleOps(x)
+ implicit def signedRichIntOps(x: scala.runtime.RichInt): SignedRichIntOps =
+ new SignedRichIntOps(
+ x.self.asInstanceOf[Int]
+ )
+ implicit def richUInt(x: UInt): RichUInt = new RichUInt(x)
+ implicit def richerUInt(x: UInt): RicherUInt = new RicherUInt(x.toInt)
class FloatOps(x: Float) {
def toUByte = UByte(x.toByte)
@@ -169,7 +170,9 @@ package object unsigned {
def toFloat(x: UByte): Float = x.toFloat
def toDouble(x: UByte): Double = x.toDouble
}
- implicit object UByteIsIntegral extends UByteIsIntegral with UByteOrdering
+ implicit object UByteIsIntegral extends UByteIsIntegral with UByteOrdering {
+ def parseString(str: String): Option[UByte] = None
+ }
trait UShortIsIntegral extends Integral[UShort] {
def plus(x: UShort, y: UShort): UShort = (x + y).toUShort
@@ -184,7 +187,9 @@ package object unsigned {
def toFloat(x: UShort): Float = x.toFloat
def toDouble(x: UShort): Double = x.toDouble
}
- implicit object UShortIsIntegral extends UShortIsIntegral with UShortOrdering
+ implicit object UShortIsIntegral extends UShortIsIntegral with
UShortOrdering {
+ def parseString(str: String): Option[UShort] = None
+ }
trait UIntIsIntegral extends Integral[UInt] {
def plus(x: UInt, y: UInt): UInt = x + y
@@ -199,7 +204,9 @@ package object unsigned {
def toFloat(x: UInt): Float = x.toFloat
def toDouble(x: UInt): Double = x.toDouble
}
- implicit object UIntIsIntegral extends UIntIsIntegral with UIntOrdering
+ implicit object UIntIsIntegral extends UIntIsIntegral with UIntOrdering {
+ def parseString(str: String): Option[UInt] = None
+ }
trait ULongIsIntegral extends Integral[ULong] {
def plus(x: ULong, y: ULong): ULong = x + y
@@ -214,7 +221,9 @@ package object unsigned {
def toFloat(x: ULong): Float = x.toFloat
def toDouble(x: ULong): Double = x.toDouble
}
- implicit object ULongIsIntegral extends ULongIsIntegral with ULongOrdering
+ implicit object ULongIsIntegral extends ULongIsIntegral with ULongOrdering {
+ def parseString(str: String): Option[ULong] = None
+ }
class RicherUInt(rep: Int) {
def bitCount = Integer.bitCount(rep)
diff --git
a/daffodil-lib/src/test/scala/org/apache/daffodil/lib/util/TestXMLCatalogAndValidate.scala
b/daffodil-lib/src/test/scala/org/apache/daffodil/lib/util/TestXMLCatalogAndValidate.scala
index 34a00a260..8544ab882 100644
---
a/daffodil-lib/src/test/scala/org/apache/daffodil/lib/util/TestXMLCatalogAndValidate.scala
+++
b/daffodil-lib/src/test/scala/org/apache/daffodil/lib/util/TestXMLCatalogAndValidate.scala
@@ -20,7 +20,6 @@ package org.apache.daffodil.lib.util
import java.io.File
import javax.xml.XMLConstants
import javax.xml.parsers.SAXParser
-import scala.collection.mutable
import scala.language.reflectiveCalls
import scala.xml.Attribute
import scala.xml.Elem
@@ -335,7 +334,7 @@ class SchemaAwareFactoryAdapter() extends
NoBindingFactoryAdapter {
// starting element tag.
// startElement saves locator information on stack
- val locatorStack = new mutable.ArrayStack[Locator]
+ val locatorStack = new Stack[Locator]
// endElement pops it off into here
var elementStartLocator: Locator = _
@@ -436,7 +435,7 @@ class SchemaAwareFactoryAdapter() extends
NoBindingFactoryAdapter {
override def endElement(uri: String, _localName: String, qname: String):
Unit = {
// println("endElement")
- elementStartLocator = locatorStack.pop
+ elementStartLocator = locatorStack.pop()
super.endElement(uri, _localName, qname)
}
diff --git
a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/ChoiceAndOtherVariousUnparsers.scala
b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/ChoiceAndOtherVariousUnparsers.scala
index 24fe3ba28..fe6adde2f 100644
---
a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/ChoiceAndOtherVariousUnparsers.scala
+++
b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/ChoiceAndOtherVariousUnparsers.scala
@@ -17,7 +17,7 @@
package org.apache.daffodil.unparsers.runtime1
-import scala.collection.JavaConverters._
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.lib.util.Maybe
import org.apache.daffodil.lib.util.Maybe._
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dsom/CompiledExpression1.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dsom/CompiledExpression1.scala
index 7db20fb56..b77cbf095 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dsom/CompiledExpression1.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dsom/CompiledExpression1.scala
@@ -27,7 +27,6 @@ import org.apache.daffodil.lib.util.Delay
import org.apache.daffodil.lib.util.Maybe
import org.apache.daffodil.lib.util.MaybeULong
import org.apache.daffodil.lib.util.PreSerialization
-import org.apache.daffodil.lib.util.TransientParam
import org.apache.daffodil.lib.xml.NS
import org.apache.daffodil.lib.xml.NamedQName
import org.apache.daffodil.lib.xml.NoNamespace
@@ -204,7 +203,7 @@ class DPathCompileInfo(
// parentsDelay is a transient due to serialization order issues causing
// stack overflows. There is no delay/lazy/by-name involvement here. See the
// lazy val parents scaladoc for a detailed explanation.
- @TransientParam parentsDelay: Delay[Seq[DPathCompileInfo]],
+ @transient parentsDelay: Delay[Seq[DPathCompileInfo]],
val variableMap: VariableMap,
val namespaces: scala.xml.NamespaceBinding,
val noPrefixNamespace: NS,
@@ -331,7 +330,7 @@ class DPathElementCompileInfo(
// parentsDelay is a transient due to serialization order issues causing
// stack overflows. There is no delay/lazy/by-name involvement here. See the
// lazy val parents scaladoc for a detailed explanation.
- @TransientParam parentsDelay: Delay[Seq[DPathElementCompileInfo]],
+ @transient parentsDelay: Delay[Seq[DPathElementCompileInfo]],
variableMap: VariableMap,
// This next arg must be a Delay as we're creating a circular
// structure here. Element's compile info points down to their children.
Children
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/Evaluatable.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/Evaluatable.scala
index 941099688..80fbdaafe 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/Evaluatable.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/Evaluatable.scala
@@ -17,7 +17,7 @@
package org.apache.daffodil.runtime1.processors
-import scala.collection.JavaConverters._
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.lib.api.DaffodilTunables
import org.apache.daffodil.lib.api.Diagnostic
diff --git
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/ElementKindParsers.scala
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/ElementKindParsers.scala
index 60f495614..5513e2957 100644
---
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/ElementKindParsers.scala
+++
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/ElementKindParsers.scala
@@ -18,7 +18,7 @@
package org.apache.daffodil.runtime1.processors.parsers
import java.math.{ BigInteger => JBigInt }
-import scala.collection.JavaConverters._
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.lib.util.Logger
import org.apache.daffodil.lib.util.Maybe
diff --git
a/daffodil-schematron/src/main/scala/org/apache/daffodil/validation/schematron/SchematronResult.scala
b/daffodil-schematron/src/main/scala/org/apache/daffodil/validation/schematron/SchematronResult.scala
index c5f16846d..ec0f8f0ba 100644
---
a/daffodil-schematron/src/main/scala/org/apache/daffodil/validation/schematron/SchematronResult.scala
+++
b/daffodil-schematron/src/main/scala/org/apache/daffodil/validation/schematron/SchematronResult.scala
@@ -18,7 +18,7 @@
package org.apache.daffodil.validation.schematron
import java.util
-import scala.collection.JavaConverters.asJavaCollectionConverter
+import scala.jdk.CollectionConverters._
import org.apache.daffodil.lib.api.ValidationFailure
import org.apache.daffodil.lib.api.ValidationResult
diff --git
a/daffodil-tdml-processor/src/test/java/org/apache/daffodil/processor/tdml/TestRunnerFactory.java
b/daffodil-tdml-processor/src/test/java/org/apache/daffodil/processor/tdml/TestRunnerFactory.java
index 1bca68026..233c36397 100644
---
a/daffodil-tdml-processor/src/test/java/org/apache/daffodil/processor/tdml/TestRunnerFactory.java
+++
b/daffodil-tdml-processor/src/test/java/org/apache/daffodil/processor/tdml/TestRunnerFactory.java
@@ -29,7 +29,7 @@ import org.junit.Test;
import org.xml.sax.InputSource;
import scala.Option;
-import scala.collection.JavaConverters;
+import scala.jdk.javaapi.CollectionConverters;
import scala.xml.Elem;
import scala.xml.XML;
import scala.util.Right;
@@ -50,7 +50,7 @@ public class TestRunnerFactory {
false,
NoRoundTrip$.MODULE$,
"off",
- JavaConverters.asScalaBufferConverter(Arrays.asList("daffodil",
"ibm")).asScala(),
+ CollectionConverters.asScala(Arrays.asList("daffodil", "ibm")),
false,
false);
runner.runOneTest("testPass");
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index cab545574..0e5d25c11 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -20,7 +20,7 @@ import
sbtunidoc.GenJavadocPlugin.autoImport.unidocGenjavadocVersion
object Dependencies {
- lazy val common = core ++ infoset ++ test
+ lazy val common = core ++ infoset ++ test ++ compat
lazy val core = Seq(
"com.lihaoyi" %% "os-lib" % "0.11.3", // for writing/compiling C source
files
@@ -68,6 +68,10 @@ object Dependencies {
"com.siemens.ct.exi" % "exificient" % "1.0.7"
)
+ lazy val compat = Seq(
+ "org.scala-lang.modules" %% "scala-collection-compat" % "2.13.0"
+ )
+
lazy val genjavadocVersion = {
// Scala Steward may try to update this version to include the Scala
version,
// for example 0.18_2.12.15. This is incorrect because the unidoc plugin
uses