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 5aca1527d Fix some deprecated collections
5aca1527d is described below

commit 5aca1527dbf7ca5075b93fb8dda7649b3c2c0fec
Author: olabusayoT <[email protected]>
AuthorDate: Fri Feb 7 14:07:22 2025 -0500

    Fix some deprecated collections
    
    - like Stream -> LazyList
    - JavaConverters -> CollectionConverters
    - some () added to method invocations
    - replace triple quoted unicode characters with regular doublequote
    - alternative ArrayBuffer1.reduceToSize1 function for 2.12 and 2.13
    - replace contents, elementChildren, and children sequences with 
child(index) and numChildren function
    - update unordered sequence tests so it's easier to tell if something is 
broken
    
    DAFFODIL-2152
---
 .../core/grammar/SequenceGrammarMixin.scala        |   4 +-
 .../org/apache/daffodil/core/util/TestUtils.scala  |   5 +-
 .../daffodil/core/dsom/TestSimpleTypeUnions.scala  |  24 ++---
 .../apache/daffodil/core/infoset/TestInfoset.scala |   4 +-
 .../infoset/TestInfosetCursorFromReader2.scala     |  10 +-
 .../daffodil/io/RegexLimitingInputStream.scala     |   7 +-
 .../io/StringDataInputStreamForUnparse.scala       |   2 +-
 .../io/processors/charset/BitsCharset.scala        |  11 +-
 .../io/processors/charset/X_DFDL_MIL_STD.scala     |   6 +-
 .../io/TestDirectOrBufferedDataOutputStream.scala  |   2 +-
 .../apache/daffodil/lib/util/ArrayBuffer1.scala    |  51 ++++++++++
 .../runtime1/debugger/InteractiveDebugger.scala    |   2 +-
 .../apache/daffodil/runtime1/dpath/DState.scala    |   9 +-
 .../daffodil/runtime1/infoset/InfosetImpl.scala    | 112 +++++++++++----------
 .../daffodil/runtime1/infoset/InfosetWalker.scala  |  18 ++--
 .../runtime1/infoset/JDOMInfosetInputter.scala     |   2 +-
 .../runtime1/infoset/JDOMInfosetOutputter.scala    |   2 +-
 .../runtime1/infoset/ScalaXMLInfosetInputter.scala |   2 +-
 .../infoset/ScalaXMLInfosetOutputter.scala         |   4 +-
 .../runtime1/infoset/W3CDOMInfosetInputter.scala   |   2 +-
 .../runtime1/infoset/W3CDOMInfosetOutputter.scala  |   2 +-
 .../daffodil/runtime1/layers/LayerDriver.scala     |   4 +-
 .../runtime1/processors/DataProcessor.scala        |   2 +-
 .../runtime1/processors/SuspensionTracker.scala    |   2 +-
 .../daffodil/runtime1/processors/dfa/Parser.scala  |   7 +-
 .../processors/parsers/DelimiterParsers.scala      |   2 +-
 .../processors/parsers/ElementKindParsers.scala    |   2 +-
 .../parsers/HiddenGroupCombinatorParser.scala      |   4 +-
 .../runtime1/processors/parsers/PState.scala       |   7 +-
 .../processors/parsers/RepTypeParsers.scala        |   2 +-
 .../processors/parsers/SequenceParserBases.scala   |   2 +-
 .../org/apache/daffodil/tdml/TDMLRunner.scala      |   7 +-
 .../section23/dfdl_functions/Functions.tdml        |  10 +-
 33 files changed, 195 insertions(+), 137 deletions(-)

diff --git 
a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/SequenceGrammarMixin.scala
 
b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/SequenceGrammarMixin.scala
index a3e872405..a87b00431 100644
--- 
a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/SequenceGrammarMixin.scala
+++ 
b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/SequenceGrammarMixin.scala
@@ -16,6 +16,8 @@
  */
 
 package org.apache.daffodil.core.grammar
+import scala.collection.compat.immutable.LazyList
+
 import org.apache.daffodil.core.dsom._
 import org.apache.daffodil.core.grammar.primitives.OrderedSequence
 import org.apache.daffodil.core.grammar.primitives.UnorderedSequence
@@ -60,7 +62,7 @@ trait SequenceGrammarMixin extends GrammarMixin with 
SequenceTermRuntime1Mixin {
   }
 
   private lazy val seqChildren = LV(Symbol("seqChildren")) {
-    (groupMembers.zip(Stream.from(1))).map { case (gm, i) =>
+    (groupMembers.zip(LazyList.from(1))).map { case (gm, i) =>
       sequenceChild(gm, i)
     }
   }.value
diff --git 
a/daffodil-core/src/main/scala/org/apache/daffodil/core/util/TestUtils.scala 
b/daffodil-core/src/main/scala/org/apache/daffodil/core/util/TestUtils.scala
index 52023ab02..fbb82944f 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/core/util/TestUtils.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/core/util/TestUtils.scala
@@ -22,6 +22,7 @@ import java.io.InputStream
 import java.nio.channels.Channels
 import java.nio.channels.ReadableByteChannel
 import java.nio.channels.WritableByteChannel
+import scala.collection.compat.immutable.LazyList
 import scala.collection.mutable.ArrayBuffer
 import scala.util.Try
 import scala.xml._
@@ -376,13 +377,13 @@ object StreamParser {
     }
   }
 
-  def doStreamTest(schema: Node, data: String): Stream[Result] = {
+  def doStreamTest(schema: Node, data: String): LazyList[Result] = {
     val mp = new StreamParser(schema)
     val is: InputStream = new ByteArrayInputStream(data.getBytes("ascii"))
     mp.setInputStream(is)
     var r: StreamParser.Result = null
     val results = new ArrayBuffer[Result]
-    val resStream = Stream.continually(mp.parse).takeWhile(r => 
!r.isProcessingError)
+    val resStream = LazyList.continually(mp.parse).takeWhile(r => 
!r.isProcessingError)
     resStream
   }
 }
diff --git 
a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestSimpleTypeUnions.scala
 
b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestSimpleTypeUnions.scala
index 8e3adfce7..f9c649f38 100644
--- 
a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestSimpleTypeUnions.scala
+++ 
b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestSimpleTypeUnions.scala
@@ -103,7 +103,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val umstrd = i.unionMemberRuntimeData.get
     assertEquals("int1Type", umstrd.diagnosticDebugName)
@@ -118,7 +118,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val umstrd = i.unionMemberRuntimeData.get
     assertEquals("int2Type", umstrd.diagnosticDebugName)
@@ -133,7 +133,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val Some(dv: java.lang.Integer) = Some(i.dataValue.getInt)
     assertEquals(3, dv.intValue())
@@ -226,7 +226,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val Some(dv: java.lang.Integer) = Some(i.dataValue.getInt)
     assertEquals(3, dv.intValue())
@@ -256,7 +256,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val umstrd = i.unionMemberRuntimeData.get
     assertEquals("int12Type", umstrd.diagnosticDebugName)
@@ -271,7 +271,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val umstrd = i.unionMemberRuntimeData.get
     assertEquals("int12Type", umstrd.diagnosticDebugName)
@@ -286,7 +286,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val umstrd = i.unionMemberRuntimeData.get
     assertEquals(
@@ -351,7 +351,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val umstrd = i.unionMemberRuntimeData.get
     assertEquals("ex:foo3or4bar", umstrd.diagnosticDebugName)
@@ -366,7 +366,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val umstrd = i.unionMemberRuntimeData.get
     assertEquals("foo1or2bar", umstrd.diagnosticDebugName)
@@ -381,7 +381,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val umstrd = i.unionMemberRuntimeData.get
     assertEquals("foo1or2bar", umstrd.diagnosticDebugName)
@@ -396,7 +396,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val Some(dv: String) = Some(i.dataValue.getString)
     assertEquals("foo4bar", dv)
@@ -430,7 +430,7 @@ class TestSimpleTypeUnions {
       .asInstanceOf[PState]
       .infoset
       .asInstanceOf[DIDocument]
-      .contents(0)
+      .child(0)
       .asInstanceOf[DISimple]
     val Some(dv: String) = Some(i.dataValue.getString)
     assertEquals("notfoo1bar", dv)
diff --git 
a/daffodil-core/src/test/scala/org/apache/daffodil/core/infoset/TestInfoset.scala
 
b/daffodil-core/src/test/scala/org/apache/daffodil/core/infoset/TestInfoset.scala
index 47f50d5c1..6a97f0fa3 100644
--- 
a/daffodil-core/src/test/scala/org/apache/daffodil/core/infoset/TestInfoset.scala
+++ 
b/daffodil-core/src/test/scala/org/apache/daffodil/core/infoset/TestInfoset.scala
@@ -70,7 +70,7 @@ object TestInfoset {
     val infosetRootNode = {
       val ustate = unparseResult.resultState.asInstanceOf[UStateMain]
       val diDocument: DIDocument = ustate.documentElement
-      val rootElement = diDocument.contents(0).asInstanceOf[DIElement]
+      val rootElement = diDocument.child(0).asInstanceOf[DIElement]
       Assert.invariant(rootElement ne null)
       rootElement
     }
@@ -440,7 +440,7 @@ class TestInfoset1 {
     }><enum>EQUAL_TO_OR_&lt;_0.0001_SQUARE_DATA_MILES</enum></root>
 
     val (infoset: DIComplex, _, tunable) = testInfoset(testSchema, xmlInfoset)
-    val enumElt: DISimple = infoset.children.head.asInstanceOf[DISimple]
+    val enumElt: DISimple = infoset.child(0).asInstanceOf[DISimple]
     val value = enumElt.dataValueAsString
     assertEquals("EQUAL_TO_OR_<_0.0001_SQUARE_DATA_MILES", value)
 
diff --git 
a/daffodil-core/src/test/scala/org/apache/daffodil/core/infoset/TestInfosetCursorFromReader2.scala
 
b/daffodil-core/src/test/scala/org/apache/daffodil/core/infoset/TestInfosetCursorFromReader2.scala
index 5bbc9e56d..68a2ae5d3 100644
--- 
a/daffodil-core/src/test/scala/org/apache/daffodil/core/infoset/TestInfosetCursorFromReader2.scala
+++ 
b/daffodil-core/src/test/scala/org/apache/daffodil/core/infoset/TestInfosetCursorFromReader2.scala
@@ -17,7 +17,7 @@
 
 package org.apache.daffodil.core.infoset
 
-import scala.collection.immutable.Stream.consWrapper
+import scala.collection.compat.immutable.LazyList
 
 import org.apache.daffodil.core.compiler.Compiler
 import org.apache.daffodil.lib.Implicits._
@@ -60,7 +60,7 @@ class TestInfosetInputterFromReader2 {
     }
     val rootERD = u.ssrd.elementRuntimeData
 
-    def foos: Stream[String] = "<foo>Hello</foo>" #:: foos
+    def foos: LazyList[String] = "<foo>Hello</foo>" #:: foos
     val ex = XMLUtils.EXAMPLE_NAMESPACE.toString
     def strings =
       (("<bar xmlns='" + ex + "' >") #:: foos.take(size))
@@ -72,11 +72,11 @@ class TestInfosetInputterFromReader2 {
     (ic, rootERD, inputter)
   }
 
-  class StreamInputStream(private var strings: Stream[String]) extends 
java.io.InputStream {
+  class StreamInputStream(private var strings: LazyList[String]) extends 
java.io.InputStream {
 
     private var bytes = {
       val ss = strings.flatMap { _.getBytes() } ++ "</bar>".getBytes().toStream
-      strings = Nil.toStream
+      strings = Nil.to(LazyList)
       ss
     }
 
@@ -89,7 +89,7 @@ class TestInfosetInputterFromReader2 {
       }
     }
 
-    override def close(): Unit = { bytes = Nil.toStream }
+    override def close(): Unit = { bytes = Nil.to(LazyList) }
   }
 
   @Test def testStreamingBehavior1(): Unit = {
diff --git 
a/daffodil-io/src/main/scala/org/apache/daffodil/io/RegexLimitingInputStream.scala
 
b/daffodil-io/src/main/scala/org/apache/daffodil/io/RegexLimitingInputStream.scala
index b386720c0..d830363e0 100644
--- 
a/daffodil-io/src/main/scala/org/apache/daffodil/io/RegexLimitingInputStream.scala
+++ 
b/daffodil-io/src/main/scala/org/apache/daffodil/io/RegexLimitingInputStream.scala
@@ -23,6 +23,7 @@ import java.nio.charset.Charset
 import java.nio.charset.StandardCharsets
 import java.util.Scanner
 import java.util.regex.Pattern
+import scala.collection.compat.immutable.LazyList
 
 import org.apache.daffodil.lib.exceptions.Assert
 
@@ -134,8 +135,8 @@ class RegexLimitingInputStream(
    * consider that the overhead is once per chunk, so honestly the
    * regex match is of more concern.
    */
-  private def chunks: Stream[String] = {
-    if (noMoreChunks) Stream()
+  private def chunks: LazyList[String] = {
+    if (noMoreChunks) LazyList()
     else {
       in.mark(lookAheadMax)
       //
@@ -168,7 +169,7 @@ class RegexLimitingInputStream(
       if (delimMatchLength > 0)
         noMoreChunks = true
       if (beforeMatchString.isEmpty)
-        Stream()
+        LazyList()
       else
         // lazy list construction. chunks will not be recursively evaluated 
unless demanded
         beforeMatchString #:: chunks
diff --git 
a/daffodil-io/src/main/scala/org/apache/daffodil/io/StringDataInputStreamForUnparse.scala
 
b/daffodil-io/src/main/scala/org/apache/daffodil/io/StringDataInputStreamForUnparse.scala
index 98f45fb1f..42162094e 100644
--- 
a/daffodil-io/src/main/scala/org/apache/daffodil/io/StringDataInputStreamForUnparse.scala
+++ 
b/daffodil-io/src/main/scala/org/apache/daffodil/io/StringDataInputStreamForUnparse.scala
@@ -88,7 +88,7 @@ final class StringDataInputStreamForUnparse extends 
DataInputStreamImplMixin {
   override def setBitLimit0b(bitLimit0b: MaybeULong): Boolean = doNotUse
   override def setDebugging(setting: Boolean): Unit = doNotUse
   override def isDefinedForLength(length: Long): Boolean = doNotUse
-  override def hasData: Boolean = doNotUse
+  override def hasData(): Boolean = doNotUse
   override def skip(nBits: Long, finfo: FormatInfo): Boolean = doNotUse
   override def resetBitLimit0b(savedBitLimit0b: MaybeULong): Unit = doNotUse
   // $COVERAGE-ON$
diff --git 
a/daffodil-io/src/main/scala/org/apache/daffodil/io/processors/charset/BitsCharset.scala
 
b/daffodil-io/src/main/scala/org/apache/daffodil/io/processors/charset/BitsCharset.scala
index 8a3b26bfd..a4d3c1191 100644
--- 
a/daffodil-io/src/main/scala/org/apache/daffodil/io/processors/charset/BitsCharset.scala
+++ 
b/daffodil-io/src/main/scala/org/apache/daffodil/io/processors/charset/BitsCharset.scala
@@ -24,7 +24,7 @@ import java.nio.charset.CoderResult
 import java.nio.charset.CodingErrorAction
 import java.nio.charset.{ Charset => JavaCharset }
 import java.nio.charset.{ CharsetEncoder => JavaCharsetEncoder }
-import scala.collection.convert.ImplicitConversions.`collection 
AsScalaIterable`
+import scala.jdk.CollectionConverters._
 
 import org.apache.daffodil.lib.exceptions.Assert
 import org.apache.daffodil.lib.schema.annotation.props.gen.BitOrder
@@ -153,9 +153,10 @@ trait BitsCharsetJava extends BitsCharset {
   }
 
   private lazy val hasNameOrAliasContainingEBCDIC = {
-    val allCharsetNames = (javaCharset.aliases().toSeq :+ name :+ 
javaCharset.name()).map {
-      _.toUpperCase
-    }
+    val allCharsetNames =
+      (javaCharset.aliases().asScala.toSeq :+ name :+ javaCharset.name()).map {
+        _.toUpperCase
+      }
     val res = allCharsetNames.exists(_.contains("EBCDIC"))
     res
   }
@@ -227,7 +228,7 @@ final class BitsCharsetWrappingJavaCharsetEncoder(
     isReset = true
     this
   }
-  def isMandatoryAlignmentNeeded = isReset
+  def isMandatoryAlignmentNeeded() = isReset
   def malformedInputAction() = enc.malformedInputAction()
   def onMalformedInput(action: CodingErrorAction) = {
     Assert.usage(isReset)
diff --git 
a/daffodil-io/src/main/scala/org/apache/daffodil/io/processors/charset/X_DFDL_MIL_STD.scala
 
b/daffodil-io/src/main/scala/org/apache/daffodil/io/processors/charset/X_DFDL_MIL_STD.scala
index 6e6a59b2a..a388946d9 100644
--- 
a/daffodil-io/src/main/scala/org/apache/daffodil/io/processors/charset/X_DFDL_MIL_STD.scala
+++ 
b/daffodil-io/src/main/scala/org/apache/daffodil/io/processors/charset/X_DFDL_MIL_STD.scala
@@ -36,7 +36,7 @@ object BitsCharset6BitDFI264DUI001 extends 
BitsCharsetNonByteSize {
   override lazy val name = "X-DFDL-6-BIT-DFI-264-DUI-001"
   override lazy val bitWidthOfACodeUnit = 6
   override lazy val decodeString =
-    """ 
123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD0"""
+    " 
123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD0"
   override lazy val replacementCharCode = 0x0
   override lazy val requiredBitOrder = BitOrder.LeastSignificantBitFirst
 }
@@ -47,7 +47,7 @@ final class BitsCharset6BitDFI264DUI001Definition
 sealed abstract class BitsCharset6BitDFI311DUI002Base extends 
BitsCharsetNonByteSize {
   override lazy val bitWidthOfACodeUnit = 6
   override lazy val decodeString =
-    """\u00A0ABCDEFGHIJKLMNOPQRSTUVWXYZ\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD 
\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD0123456789\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"""
+    "\u00A0ABCDEFGHIJKLMNOPQRSTUVWXYZ\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD 
\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD0123456789\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"
   override lazy val replacementCharCode = 0x0
 }
 
@@ -126,7 +126,7 @@ object BitsCharset5BitDFI1661DUI001 extends 
BitsCharsetNonByteSize {
   override lazy val name = "X-DFDL-5-BIT-DFI-1661-DUI-001"
   override lazy val bitWidthOfACodeUnit = 5
   override lazy val decodeString =
-    """\u00A0ABCDEFGHIJKLMNOPQRSTUVWXYZ\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"""
+    "\u00A0ABCDEFGHIJKLMNOPQRSTUVWXYZ\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"
   override lazy val replacementCharCode = 0x0
   override lazy val requiredBitOrder = BitOrder.LeastSignificantBitFirst
 }
diff --git 
a/daffodil-io/src/test/scala/org/apache/daffodil/io/TestDirectOrBufferedDataOutputStream.scala
 
b/daffodil-io/src/test/scala/org/apache/daffodil/io/TestDirectOrBufferedDataOutputStream.scala
index 8fc78b59b..f241932e4 100644
--- 
a/daffodil-io/src/test/scala/org/apache/daffodil/io/TestDirectOrBufferedDataOutputStream.scala
+++ 
b/daffodil-io/src/test/scala/org/apache/daffodil/io/TestDirectOrBufferedDataOutputStream.scala
@@ -34,7 +34,7 @@ class TestDirectOrBufferedDataOutputStream {
     val is = new ByteArrayInputStream(baos.getBuf)
     val ir = new InputStreamReader(is, "ascii")
     val line = IOUtils.toString(ir)
-    val res = line.replace("""\u0000""", "")
+    val res = line.replace("\u0000", "")
     res
   }
 
diff --git 
a/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/ArrayBuffer1.scala 
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/ArrayBuffer1.scala
new file mode 100644
index 000000000..720043703
--- /dev/null
+++ 
b/daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/ArrayBuffer1.scala
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ */
+
+package org.apache.daffodil.lib.util
+
+import java.util
+import scala.collection.mutable.ArrayBuffer
+
+/**
+ * Compatibility ArrayBuffer class for 2.12 and 2.13 since reduceToSize
+ * has been removed in 2.13. This allows us to maintain the same
+ * functionality as 2.12 while upgraded to 2.13
+ */
+class ArrayBuffer1[T](initialSize: Int = 16) extends ArrayBuffer[T] {
+  // Preallocate space to avoid frequent resizing
+  this.sizeHint(initialSize)
+
+  def reduceToSize1(sz: Int): Unit = {
+    if (sz >= 0 && sz <= size0) {
+      // to ensure things are not left un-garbage collected
+      util.Arrays.fill(array, sz, size0, null)
+      size0 = sz
+    } else
+      throw new IndexOutOfBoundsException(
+        "Invalid size: Must be between 0 and the current size of the buffer."
+      )
+  }
+}
+
+object ArrayBuffer1 extends ArrayBuffer {
+  def apply[T](ab: ArrayBuffer[T]): ArrayBuffer1[T] = {
+    val s = ab.length
+    val arr = new ArrayBuffer1[T](s)
+    arr ++= ab
+    arr
+  }
+}
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/debugger/InteractiveDebugger.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/debugger/InteractiveDebugger.scala
index 9305698eb..78fc9b840 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/debugger/InteractiveDebugger.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/debugger/InteractiveDebugger.scala
@@ -1807,7 +1807,7 @@ class InteractiveDebugger(
             }
 
             node match {
-              case d: DIDocument if d.contents.size == 0 => {
+              case d: DIDocument if d.numChildren == 0 => {
                 debugPrintln("No Infoset", "  ")
               }
               case _ => {
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dpath/DState.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dpath/DState.scala
index c29861ca6..6364b2271 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dpath/DState.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dpath/DState.scala
@@ -25,7 +25,6 @@ import org.apache.daffodil.lib.util.Maybe
 import org.apache.daffodil.lib.util.Maybe.Nope
 import org.apache.daffodil.lib.util.Maybe.One
 import org.apache.daffodil.runtime1.infoset.DIArray
-import org.apache.daffodil.runtime1.infoset.DIComplex
 import org.apache.daffodil.runtime1.infoset.DIElement
 import org.apache.daffodil.runtime1.infoset.DINode
 import org.apache.daffodil.runtime1.infoset.DISimple
@@ -282,17 +281,15 @@ case class DState(
   def currentComplex = currentNode.asComplex
 
   def nextSibling = {
-    val contents = currentElement.parent.asInstanceOf[DIComplex].contents
-
     // TOOD, currentNode should really know this
-    val i = contents.indexOf(currentNode)
-    if (i == contents.length - 1) {
+    val i = currentElement.parent.indexOf(currentNode)
+    if (i == currentElement.parent.numChildren - 1) {
       throw new InfosetNoNextSiblingException(
         currentNode.asSimple,
         currentNode.erd.dpathElementCompileInfo
       )
     } else {
-      contents(i + 1)
+      currentElement.parent.child(i + 1)
     }
   }
 
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetImpl.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetImpl.scala
index 6c953fef6..281cff949 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetImpl.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetImpl.scala
@@ -30,7 +30,6 @@ import java.math.{ BigInteger => JBigInt }
 import java.net.URI
 import java.util.concurrent.atomic.AtomicInteger
 import java.util.concurrent.atomic.AtomicLong
-import scala.collection.mutable.ArrayBuffer
 
 import org.apache.daffodil.io.DataOutputStream
 import org.apache.daffodil.io.DirectOrBufferedDataOutputStream
@@ -42,6 +41,7 @@ import org.apache.daffodil.lib.equality.TypeEqual
 import org.apache.daffodil.lib.equality.ViewEqual
 import org.apache.daffodil.lib.exceptions.Assert
 import org.apache.daffodil.lib.exceptions.ThinException
+import org.apache.daffodil.lib.util.ArrayBuffer1
 import org.apache.daffodil.lib.util.Logger
 import org.apache.daffodil.lib.util.Maybe
 import org.apache.daffodil.lib.util.Maybe.Nope
@@ -125,18 +125,15 @@ sealed trait DINode {
   def isDefaulted: Boolean
   def isHidden: Boolean
 
-  def children: Stream[DINode]
+  def indexOf(item: DINode): Int
+  def find(func: DINode => Boolean): Option[DINode]
   def namedQName: NamedQName
   def erd: ElementRuntimeData
 
   def infosetWalkerBlockCount: Int
 
-  /**
-   * Can treat any DINode, even simple ones, as a container of other nodes.
-   * This simplifies walking an infoset.
-   */
-  def contents: IndexedSeq[DINode]
-  final def numChildren = contents.length
+  def child(index: Int): DINode
+  def numChildren: Int
 
   /**
    * If there are any children, returns the last child as a One(lastChild).
@@ -441,7 +438,6 @@ final class FakeDINode extends DISimple(null) {
   override def valid = die
   override def setValid(validity: Boolean): Unit = die
   override def isDefaulted: Boolean = die
-  override def children = die
   override def contentLength: ContentLengthState = die
   override def valueLength: ValueLengthState = die
   override def primType: NodeInfo.PrimType = die
@@ -1161,12 +1157,12 @@ final class DIArray(
   override val erd: ElementRuntimeData,
   val parent: DIComplex,
   initialSize: Int // TODO: really this needs to be adaptive, and resize 
upwards reasonably.
-//A non-copying thing - list like, may be better, but we do need access to be
-//constant time.
-// FIXME: for streaming behavior, arrays are going to get elements removed from
-// them when no longer needed. However, the array itself would still be growing
-// without bound. So, replace this with a mutable map so that it can shrink
-// as well as grow. // not saved. Needed only to get initial size.
+  // A non-copying thing - list like, may be better, but we do need access to 
be
+  // constant time.
+  // FIXME: for streaming behavior, arrays are going to get elements removed 
from
+  // them when no longer needed. However, the array itself would still be 
growing
+  // without bound. So, replace this with a mutable map so that it can shrink
+  // as well as grow. // not saved. Needed only to get initial size.
 ) extends DINode
   with InfosetArray {
 
@@ -1220,19 +1216,22 @@ final class DIArray(
 
   def namedQName = erd.namedQName
 
-  protected final val _contents = new ArrayBuffer[DIElement](initialSize)
+  protected final val _contents = new ArrayBuffer1[DIElement](initialSize)
 
-  override def children: Stream[DINode] = 
_contents.toStream.asInstanceOf[Stream[DINode]]
+  override def indexOf(item: DINode): Int = _contents.indexOf(item)
 
   /**
    * Used to shorten array when backtracking out of having appended elements.
    */
   def reduceToSize(n: Int): Unit = {
-    _contents.reduceToSize(n)
+    _contents.reduceToSize1(n)
   }
 
-  override def contents: IndexedSeq[DINode] = _contents
-  def elementContents: IndexedSeq[DIElement] = _contents
+  override def numChildren: Int = _contents.length
+
+  override def child(index: Int): DINode = _contents(index)
+
+  override def find(func: DINode => Boolean): Option[DINode] = 
_contents.find(func)
 
   override def maybeLastChild: Maybe[DINode] = {
     val len = _contents.length
@@ -1261,23 +1260,22 @@ final class DIArray(
   }
 
   def append(ie: DIElement): Unit = {
-    _contents += ie.asInstanceOf[DIElement]
+    _contents += ie
     ie.setArray(this)
   }
 
   def concat(array: DIArray): Unit = {
-    val newContents = array.elementContents
-    newContents.foreach { ie =>
-      {
-        ie.setArray(this)
-        append(ie)
-      }
+    for (i <- 0 until array.numChildren) {
+      val in = array.child(i)
+      val ie = in.asInstanceOf[DIElement]
+      ie.setArray(this)
+      append(ie)
     }
   }
 
   final def length: Long = _contents.length
 
-  final def isDefaulted: Boolean = children.forall { _.isDefaulted }
+  final def isDefaulted: Boolean = _contents.forall { _.isDefaulted }
 
   final def freeChildIfNoLongerNeeded(index: Int, doFree: Boolean): Unit = {
     val node = _contents(index)
@@ -1317,12 +1315,17 @@ sealed class DISimple(override val erd: 
ElementRuntimeData)
 
   def primType: NodeInfo.PrimType = erd.optPrimType.orNull
 
-  def contents: IndexedSeq[DINode] = IndexedSeq.empty
-
   private var _stringRep: String = null
   private var _bdRep: JBigDecimal = null
 
-  override def children: Stream[DINode] = Stream.Empty
+  override def child(index: Int): DINode =
+    Assert.invariantFailed("DISimple cannot have child nodes")
+
+  override def indexOf(item: DINode): Int = -1
+
+  override def find(func: DINode => Boolean): Option[DINode] = None
+
+  override def numChildren: Int = 0
 
   override def maybeLastChild: Maybe[DINode] = Nope
 
@@ -1670,14 +1673,18 @@ sealed class DIComplex(override val erd: 
ElementRuntimeData)
     if (!isFinal) throw nfe
   }
 
-  val childNodes = new ArrayBuffer[DINode]
+  private val childNodes = new ArrayBuffer1[DINode]
 
   private lazy val nameToChildNodeLookup =
-    new java.util.HashMap[NamedQName, ArrayBuffer[DINode]]
+    new java.util.HashMap[NamedQName, ArrayBuffer1[DINode]]
 
-  override lazy val contents: IndexedSeq[DINode] = childNodes
+  override def numChildren: Int = childNodes.length
 
-  override def children = childNodes.toStream
+  override def child(index: Int): DINode = childNodes(index)
+
+  override def indexOf(item: DINode): Int = childNodes.indexOf(item)
+
+  override def find(func: DINode => Boolean): Option[DINode] = 
childNodes.find(func)
 
   override def maybeLastChild: Maybe[DINode] = {
     val len = childNodes.length
@@ -1735,7 +1742,7 @@ sealed class DIComplex(override val erd: 
ElementRuntimeData)
   }
 
   def freeChildIfNoLongerNeeded(index: Int, doFree: Boolean): Unit = {
-    val node = childNodes(index)
+    val node = child(index)
     if (!node.erd.dpathElementCompileInfo.isReferencedByExpressions) {
       if (doFree) {
         // set to null so that the garbage collector can free this node
@@ -1759,7 +1766,8 @@ sealed class DIComplex(override val erd: 
ElementRuntimeData)
     val groups = unordered.groupBy(_.erd)
     unordered.clear()
     groups.foreach {
-      case (erd, nodes) => {
+      case (erd, _nodes) => {
+        val nodes = ArrayBuffer1(_nodes)
         // Check min/maxOccurs validity while iterating over childNodes
         val min = erd.minOccurs
         val max = erd.maxOccurs
@@ -1769,15 +1777,15 @@ sealed class DIComplex(override val erd: 
ElementRuntimeData)
         if (erd.isArray) {
           val a = nodes(0).asInstanceOf[DIArray]
           nodes.tail.foreach(b => a.concat(b.asInstanceOf[DIArray]))
-          nodes.reduceToSize(1)
+          nodes.reduceToSize1(1)
 
           // Need to also remove duplicates from fastLookup
           val fastSeq = nameToChildNodeLookup.get(a.namedQName)
           if (fastSeq != null)
-            fastSeq.reduceToSize(1)
+            fastSeq.reduceToSize1(1)
 
           // Validate min/maxOccurs for array
-          val occurrence = nodes(0).contents.length
+          val occurrence = nodes(0).numChildren
           if (isUnbounded && occurrence < min)
             pstate.validationError(
               "Element %s failed check of minOccurs='%s' and 
maxOccurs='unbounded', actual number of occurrences: %s",
@@ -1865,7 +1873,7 @@ sealed class DIComplex(override val erd: 
ElementRuntimeData)
       if (fastSeq != null) {
         fastSeq += node
       } else {
-        val ab = new ArrayBuffer[DINode]()
+        val ab = new ArrayBuffer1[DINode]()
         ab += node
         nameToChildNodeLookup.put(name, ab)
       }
@@ -1888,7 +1896,7 @@ sealed class DIComplex(override val erd: 
ElementRuntimeData)
     if (fastSeq != null) {
       // Daffodil does not support query expressions yet, so there should only
       // be one item in the list
-      noQuerySupportCheck(fastSeq, qname)
+      noQuerySupportCheck(fastSeq.toSeq, qname)
       One(fastSeq(0))
     } else if (enableLinearSearchIfNotFound) {
       // Only DINodes used in expressions defined in the schema are added to
@@ -1908,7 +1916,7 @@ sealed class DIComplex(override val erd: 
ElementRuntimeData)
 
       // Daffodil does not support query expressions yet, so there should be at
       // most one item found
-      noQuerySupportCheck(found, qname)
+      noQuerySupportCheck(found.toSeq, qname)
       Maybe.toMaybe(found.headOption)
     } else {
       Nope
@@ -1942,13 +1950,13 @@ sealed class DIComplex(override val erd: 
ElementRuntimeData)
           nameToChildNodeLookup.remove(childToRemove.namedQName)
         } else {
           // not the last one, just drop the end
-          fastSeq.reduceToSize(fastSeq.length - 1)
+          fastSeq.reduceToSize1(fastSeq.length - 1)
         }
       }
       i -= 1
     }
     // now just quickly remove all those children
-    childNodes.reduceToSize(cs._numChildren)
+    childNodes.reduceToSize1(cs._numChildren)
     _numChildren = cs._numChildren
 
     if (cs._arraySize.isDefined && _numChildren > 0) {
@@ -1984,13 +1992,13 @@ object Infoset {
   }
 
   /**
-  * Create a new detached infoset with a single specified element. This
-  * essentially creates another infoset with a completely differed DIDocument
-  * so care should be taken to ensure things like expressions are not evaluated
-  * or new elements are not added within the scope of this infoset, as it will
-  * have no access to the true infoset. It is up to the caller to ensure the
-  * return infoset element is used safely
-  */
+   * Create a new detached infoset with a single specified element. This
+   * essentially creates another infoset with a completely differed DIDocument
+   * so care should be taken to ensure things like expressions are not 
evaluated
+   * or new elements are not added within the scope of this infoset, as it will
+   * have no access to the true infoset. It is up to the caller to ensure the
+   * return infoset element is used safely
+   */
   def newDetachedElement(
     state: ParseOrUnparseState,
     erd: ElementRuntimeData
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetWalker.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetWalker.scala
index 8af95a5b2..573242a53 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetWalker.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetWalker.scala
@@ -95,7 +95,7 @@ object InfosetWalker {
         val container: DINode =
           if (root.maybeArray.isDefined) 
root.maybeArray.get.asInstanceOf[DINode]
           else root.parent.asInstanceOf[DINode]
-        (container, container.contents.indexOf(root))
+        (container, container.indexOf(root))
       }
     }
     new InfosetWalker(
@@ -386,12 +386,10 @@ class InfosetWalker private (
       // no blocks on the container, figure out if we can take a step for the
       // element at the child index of this container
 
-      val children = containerNode.contents
-
-      if (containerIndex < children.length) {
+      if (containerIndex < containerNode.numChildren) {
         // There is a child element at this index. Taking a step would create
         // the events for, and moved passed, this element.
-        val elem = children(containerIndex)
+        val elem = containerNode.child(containerIndex)
         if (elem.infosetWalkerBlockCount > 0) {
           // This element has a block associated with it, likely meaning we are
           // speculatively parsing this element and so it may or may not exist.
@@ -492,18 +490,16 @@ class InfosetWalker private (
    * so we are looking at the next node in the infoset.
    */
   private def infosetWalkerStepMove(containerNode: DINode, containerIndex: 
Int): Unit = {
-    val children = containerNode.contents
-
-    if (containerIndex < children.size) {
-      // This block means we need to create a start event for the element in
-      // the children array at containerIndex. Once we create that event we
+    if (containerIndex < containerNode.numChildren) {
+      // This block means we need to create a start event for the element
+      // at containerIndex. Once we create that event we
       // need to mutate the state of the InfosetWalker so that the next time we
       // take a step we are looking at the next element. If this is a complex
       // type, that next element is the first child. If this is a simple type,
       // that next element is the next sibling of this element. We will mutate
       // the state accordingly.
 
-      val child = children(containerIndex)
+      val child = containerNode.child(containerIndex)
 
       if (child.isSimple) {
         if (!child.isHidden || walkHidden) {
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/JDOMInfosetInputter.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/JDOMInfosetInputter.scala
index 0d4f387a8..b33fd0dee 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/JDOMInfosetInputter.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/JDOMInfosetInputter.scala
@@ -136,7 +136,7 @@ class JDOMInfosetInputter(doc: Document) extends 
InfosetInputter {
   }
 
   override def fini = {
-    stack.clear
+    stack.clear()
   }
 
   /**
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/JDOMInfosetOutputter.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/JDOMInfosetOutputter.scala
index 3fc3c520a..38b2350b2 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/JDOMInfosetOutputter.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/JDOMInfosetOutputter.scala
@@ -36,7 +36,7 @@ class JDOMInfosetOutputter extends InfosetOutputter {
   def reset()
     : Unit = { // call to reuse these. When first constructed no reset call is 
necessary.
     result = Maybe.Nope
-    stack.clear
+    stack.clear()
   }
 
   def startDocument(): Unit = {
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/ScalaXMLInfosetInputter.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/ScalaXMLInfosetInputter.scala
index 04ae10a8c..3eada9683 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/ScalaXMLInfosetInputter.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/ScalaXMLInfosetInputter.scala
@@ -152,7 +152,7 @@ class ScalaXMLInfosetInputter(rootNode: Node) extends 
InfosetInputter {
   }
 
   override def fini = {
-    stack.clear
+    stack.clear()
   }
 
   /**
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/ScalaXMLInfosetOutputter.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/ScalaXMLInfosetOutputter.scala
index 98b17b8ae..3428700ab 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/ScalaXMLInfosetOutputter.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/ScalaXMLInfosetOutputter.scala
@@ -39,7 +39,7 @@ class ScalaXMLInfosetOutputter(showFreedInfo: Boolean = 
false) extends InfosetOu
   def reset()
     : Unit = { // call to reuse these. When first constructed no reset call is 
necessary.
     resultNode = Maybe.Nope
-    stack.clear
+    stack.clear()
   }
 
   def startDocument(): Unit = {
@@ -59,7 +59,7 @@ class ScalaXMLInfosetOutputter(showFreedInfo: Boolean = 
false) extends InfosetOu
         val selfFreed = diElem.wouldHaveBeenFreed
         val arrayFreed =
           if (diElem.erd.isArray)
-            diElem.diParent.children
+            diElem.diParent
               .find {
                 _.erd eq diElem.erd
               }
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/W3CDOMInfosetInputter.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/W3CDOMInfosetInputter.scala
index 159db706c..46b90a799 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/W3CDOMInfosetInputter.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/W3CDOMInfosetInputter.scala
@@ -138,7 +138,7 @@ class W3CDOMInfosetInputter(doc: Document) extends 
InfosetInputter {
   }
 
   override def fini = {
-    stack.clear
+    stack.clear()
   }
 
   /**
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/W3CDOMInfosetOutputter.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/W3CDOMInfosetOutputter.scala
index 493867b8b..e365de6cb 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/W3CDOMInfosetOutputter.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/W3CDOMInfosetOutputter.scala
@@ -43,7 +43,7 @@ class W3CDOMInfosetOutputter extends InfosetOutputter {
     : Unit = { // call to reuse these. When first constructed no reset call is 
necessary.
     result = Maybe.Nope
     document = null
-    stack.clear
+    stack.clear()
   }
 
   def startDocument(): Unit = {
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/layers/LayerDriver.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/layers/LayerDriver.scala
index 7c55c909b..1f9d1fa3e 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/layers/LayerDriver.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/layers/LayerDriver.scala
@@ -20,7 +20,7 @@ package org.apache.daffodil.runtime1.layers
 import java.io.FilterInputStream
 import java.io.InputStream
 import java.io.OutputStream
-import scala.collection.convert.ImplicitConversions.`collection 
AsScalaIterable`
+import scala.jdk.CollectionConverters._
 
 import org.apache.daffodil.io.DataInputStream.Mark
 import org.apache.daffodil.io.DataOutputStream
@@ -92,7 +92,7 @@ class LayerDriver private (val layer: Layer) {
       // because we want to deal with RuntimeException as if it was NOT a 
subclass of
       // Exception, we first divide up the classes as to whether they are 
RuntimeExceptions or not.
       val (runtimeExceptionSubClasses, regularExceptionSubclasses) =
-        layer.getProcessingErrorExceptions.partition { c =>
+        layer.getProcessingErrorExceptions.asScala.partition { c =>
           classOf[RuntimeException].isAssignableFrom(c)
         }
 
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/DataProcessor.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/DataProcessor.scala
index 02751d959..27b62d823 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/DataProcessor.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/DataProcessor.scala
@@ -475,7 +475,7 @@ class DataProcessor(
           // is the root node has not been set final because isFinal is handled
           // by the sequence parser and there is no sequence around the root
           // node. So mark it final and do one last walk to end the document.
-          state.infoset.contents(0).isFinal = true
+          state.infoset.child(0).isFinal = true
           state.walker.walk(lastWalk = true)
           Assert.invariant(state.walker.isFinished)
         }
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/SuspensionTracker.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/SuspensionTracker.scala
index d0c6f28c4..b9c699235 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/SuspensionTracker.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/SuspensionTracker.scala
@@ -85,7 +85,7 @@ class SuspensionTracker(suspensionWaitYoung: Int, 
suspensionWaitOld: Int) {
     )
 
     if (suspensionsOld.nonEmpty) {
-      throw new SuspensionDeadlockException(suspensionsOld.seq)
+      throw new SuspensionDeadlockException(suspensionsOld.toSeq)
     }
 
     Logger.log.debug(
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/dfa/Parser.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/dfa/Parser.scala
index 83d896904..99cc6efd2 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/dfa/Parser.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/dfa/Parser.scala
@@ -19,6 +19,7 @@ package org.apache.daffodil.runtime1.processors.dfa
 
 import scala.collection.mutable.ArrayBuffer
 
+import org.apache.daffodil.lib.util.ArrayBuffer1
 import org.apache.daffodil.lib.util.Maybe
 import org.apache.daffodil.runtime1.processors.RuntimeData
 
@@ -35,7 +36,7 @@ abstract class DFAParser extends Serializable {
 }
 
 class LongestMatchTracker {
-  val longestMatches: ArrayBuffer[DFADelimiter] = ArrayBuffer.empty
+  val longestMatches: ArrayBuffer1[DFADelimiter] = new 
ArrayBuffer1[DFADelimiter]
   var longestMatchedStartPos: Int = Int.MaxValue
   var longestMatchedString: String = null
 
@@ -54,14 +55,14 @@ class LongestMatchTracker {
       // match starts earlier than previous matches, make it the longest
       longestMatchedStartPos = matchedStartPos
       longestMatchedString = matchedString.toString
-      longestMatches.reduceToSize(0)
+      longestMatches.reduceToSize1(0)
       longestMatches.append(dfa)
     } else if (matchedStartPos == longestMatchedStartPos) {
       if (matchedString.length > longestMatchedString.length) {
         // match starts at the same point as previous matches, but
         // is longer. make it the only match
         longestMatchedString = matchedString.toString
-        longestMatches.reduceToSize(0)
+        longestMatches.reduceToSize1(0)
         longestMatches.append(dfa)
       } else if (matchedString.length == longestMatchedString.length) {
         // match starts at the same point as previous matches,
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/DelimiterParsers.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/DelimiterParsers.scala
index 2ae2fb23a..3508ad687 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/DelimiterParsers.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/DelimiterParsers.scala
@@ -81,7 +81,7 @@ class DelimiterTextParser(
     val localIndexStart = state.mpstate.delimitersLocalIndexStack.top
     val inScopeDelimiters = state.mpstate.delimiters
     val res = inScopeDelimiters.slice(localIndexStart, 
inScopeDelimiters.length)
-    res
+    res.toSeq
   }
 
   private def didNotFindExpectedDelimiter(foundDelimiter: ParseResult, start: 
PState): Unit = {
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 5513e2957..beb9a3d00 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
@@ -80,7 +80,7 @@ class DelimiterStackParser(
       bodyParser.parse1(start)
     } finally {
       // pop delimiters
-      
start.mpstate.delimiters.reduceToSize(start.mpstate.delimitersLocalIndexStack.pop)
+      
start.mpstate.delimiters.reduceToSize1(start.mpstate.delimitersLocalIndexStack.pop())
     }
   }
 }
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/HiddenGroupCombinatorParser.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/HiddenGroupCombinatorParser.scala
index 6f1b674b4..acc82aa0d 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/HiddenGroupCombinatorParser.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/HiddenGroupCombinatorParser.scala
@@ -34,11 +34,11 @@ class HiddenGroupCombinatorParser(ctxt: 
ModelGroupRuntimeData, bodyParser: Parse
 
   def parse(start: PState): Unit = {
     try {
-      start.incrementHiddenDef
+      start.incrementHiddenDef()
       // parse
       bodyParser.parse1(start)
     } finally {
-      start.decrementHiddenDef
+      start.decrementHiddenDef()
     }
   }
 }
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/PState.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/PState.scala
index 1f87dd577..3030883f7 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/PState.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/PState.scala
@@ -21,7 +21,6 @@ import java.nio.channels.Channels
 import java.nio.charset.StandardCharsets
 import java.nio.file.Files
 import java.nio.file.Path
-import scala.collection.mutable
 
 import org.apache.daffodil.io.DataInputStream
 import org.apache.daffodil.io.InputSourceDataInputStream
@@ -31,6 +30,7 @@ import org.apache.daffodil.lib.api.Diagnostic
 import org.apache.daffodil.lib.exceptions.Abort
 import org.apache.daffodil.lib.exceptions.Assert
 import org.apache.daffodil.lib.exceptions.ThrowsSDE
+import org.apache.daffodil.lib.util.ArrayBuffer1
 import org.apache.daffodil.lib.util.MStack
 import org.apache.daffodil.lib.util.MStackOf
 import org.apache.daffodil.lib.util.MStackOfInt
@@ -130,14 +130,13 @@ class MPState private () {
   // TODO: it doesn't look anything is actually reading the value of childindex
   // stack. Can we get rid of it?
   val childIndexStack = MStackOfLong()
-  def moveOverOneElementChildOnly() = childIndexStack.push(childIndexStack.pop 
+ 1)
+  def moveOverOneElementChildOnly() = 
childIndexStack.push(childIndexStack.pop() + 1)
   def childPos = {
     val res = childIndexStack.top
     Assert.invariant(res >= 1)
     res
   }
-
-  val delimiters = new mutable.ArrayBuffer[DFADelimiter]
+  val delimiters = new ArrayBuffer1[DFADelimiter]
   val delimitersLocalIndexStack = MStackOfInt()
 
   val escapeSchemeEVCache = new MStackOfMaybe[EscapeSchemeParserHelper]
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/RepTypeParsers.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/RepTypeParsers.scala
index c6f067a86..e57e8771a 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/RepTypeParsers.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/RepTypeParsers.scala
@@ -71,7 +71,7 @@ trait WithDetachedParser {
       detachedParser.parse1(pstate)
 
       val res: DataValuePrimitiveNullable = pstate.processorStatus match {
-        case Success => pstate.infoset.children.last.asSimple.dataValue
+        case Success => pstate.infoset.child(pstate.infoset.numChildren - 
1).asSimple.dataValue
         case _ => DataValue.NoValue
       }
 
diff --git 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SequenceParserBases.scala
 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SequenceParserBases.scala
index 768d7fd32..c621b3a55 100644
--- 
a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SequenceParserBases.scala
+++ 
b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SequenceParserBases.scala
@@ -87,7 +87,7 @@ abstract class SequenceParserBase(
 
       var resultOfTry: ParseAttemptStatus = ParseAttemptStatus.Uninitialized
 
-      val infosetIndexStart = 
pstate.infoset.asInstanceOf[DIComplex].childNodes.size
+      val infosetIndexStart = 
pstate.infoset.asInstanceOf[DIComplex].numChildren
 
       if (!isOrdered) {
         // If this is an unordered sequence, upon completion of parsing all the
diff --git 
a/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala 
b/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
index 4db42b4b4..8fac9fba5 100644
--- a/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
+++ b/daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
@@ -28,6 +28,7 @@ import java.nio.CharBuffer
 import java.nio.LongBuffer
 import java.nio.charset.CoderResult
 import java.nio.charset.StandardCharsets
+import scala.collection.compat.immutable.LazyList
 import scala.collection.mutable
 import scala.language.postfixOps
 import scala.util.Try
@@ -1835,7 +1836,7 @@ object VerifyTestCase {
       )
     }
 
-    val pairs = expectedBytes.zip(actualBytes).zip(Stream.from(1))
+    val pairs = expectedBytes.zip(actualBytes).zip(LazyList.from(1))
     pairs.foreach { case ((expected, actual), index) =>
       if (expected != actual) {
         val msg = ("Unparsed data differs at byte %d. Expected 0x%02x. Actual 
was 0x%02x.\n" +
@@ -2051,7 +2052,7 @@ object VerifyTestCase {
       )
     }
 
-    val pairs = expectedText.toSeq.zip(actualText.toSeq).zip(Stream.from(1))
+    val pairs = expectedText.toSeq.zip(actualText.toSeq).zip(LazyList.from(1))
     pairs.foreach { case ((expected, actual), index) =>
       if (expected != actual) {
         val msg =
@@ -2111,7 +2112,7 @@ object VerifyTestCase {
       )
     }
 
-    val pairs = expectedBytes.zip(actualBytes).zip(Stream.from(1))
+    val pairs = expectedBytes.zip(actualBytes).zip(LazyList.from(1))
     pairs.foreach { case ((expected, actual), index) =>
       if (expected != actual) {
         val msg = "Unparsed data differs at byte %d. Expected 0x%02x. Actual 
was 0x%02x."
diff --git 
a/daffodil-test/src/test/resources/org/apache/daffodil/section23/dfdl_functions/Functions.tdml
 
b/daffodil-test/src/test/resources/org/apache/daffodil/section23/dfdl_functions/Functions.tdml
index a5f414b3b..a9a8679a6 100644
--- 
a/daffodil-test/src/test/resources/org/apache/daffodil/section23/dfdl_functions/Functions.tdml
+++ 
b/daffodil-test/src/test/resources/org/apache/daffodil/section23/dfdl_functions/Functions.tdml
@@ -11323,7 +11323,7 @@
     model="XPathFunctions" description="Section 23 - Functions - fn:count - 
DFDL-23-124R">
 
     <tdml:document>
-      <tdml:documentPart 
type="text">B:6,B:1,P:3,B:6,B:2,P:3,P:3</tdml:documentPart>
+      <tdml:documentPart 
type="text">B:6,B:1,P:3,B:5,B:4,P:8,P:9</tdml:documentPart>
     </tdml:document>
     <tdml:infoset>
       <tdml:dfdlInfoset>
@@ -11331,11 +11331,11 @@
           <scores>
             <bobcats>6</bobcats>
             <bobcats>1</bobcats>
-            <bobcats>6</bobcats>
-            <bobcats>2</bobcats>
-            <pirates>3</pirates>
-            <pirates>3</pirates>
+            <bobcats>5</bobcats>
+            <bobcats>4</bobcats>
             <pirates>3</pirates>
+            <pirates>8</pirates>
+            <pirates>9</pirates>
           </scores>
           <bobcatScoreCount>4</bobcatScoreCount>
           <pirateScoreCount>3</pirateScoreCount>

Reply via email to