Skip to content

Commit 08e28a9

Browse files
committed
Fix More Deprecated Auto Application of ()
- add () to some method invocations - fix comparison of String to NS - explicitly convert long to double using .toDouble - convert number to string before concatenating DAFFODIL-2152
1 parent f487790 commit 08e28a9

File tree

10 files changed

+24
-22
lines changed

10 files changed

+24
-22
lines changed

daffodil-io/src/main/scala/org/apache/daffodil/io/InputSourceDataInputStream.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ final class InputSourceDataInputStream private (val inputSource: InputSource)
141141
* may become available in the future. This should really only be used for
142142
* debug or diagnostic purposes.
143143
*/
144-
def knownBytesAvailable: Long = inputSource.knownBytesAvailable
144+
def knownBytesAvailable: Long = inputSource.knownBytesAvailable()
145145

146146
def setBitPos0b(newBitPos0b: Long): Unit = {
147147
// threadCheck()
@@ -612,7 +612,7 @@ final class InputSourceDataInputStream private (val inputSource: InputSource)
612612

613613
def validateFinalStreamState(): Unit = {
614614
// threadCheck()
615-
markPool.finalCheck
615+
markPool.finalCheck()
616616
}
617617

618618
/**
@@ -804,7 +804,8 @@ final class InputSourceDataInputStream private (val inputSource: InputSource)
804804
// need to call areBytesAvailable first to ensure at least length bytes are
805805
// buffered if they exist
806806
val available = inputSource.areBytesAvailable(nBytesRequested)
807-
val bytesToRead = if (available) nBytesRequested else inputSource.knownBytesAvailable.toInt
807+
val bytesToRead =
808+
if (available) nBytesRequested else inputSource.knownBytesAvailable().toInt
808809
val array = new Array[Byte](bytesToRead)
809810
inputSource.get(array, 0, bytesToRead)
810811

daffodil-io/src/main/scala/org/apache/daffodil/io/processors/charset/BitsCharsetNonByteSize.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ final class BitsCharsetNonByteSizeEncoder(
247247
charCode.get
248248
} else {
249249
// character must fit in the bit width of a code unit, unmappable error
250-
val unmappableAction = unmappableCharacterAction
250+
val unmappableAction = unmappableCharacterAction()
251251
if (unmappableAction == CodingErrorAction.REPLACE) {
252252
// CharsetEncoder, which handles character replacement, assumes
253253
// that the replacement character is made up of full bytes. That

daffodil-io/src/main/scala/org/apache/daffodil/io/processors/charset/CharsetUtils.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ object CharsetUtils {
3838
if (cs == null)
3939
null
4040
else
41-
cs.charset
41+
cs.charset()
4242
}
4343

4444
def supportedEncodingsString = BitsCharsetDefinitionRegistry.supportedEncodingsString

daffodil-lib/src/test/scala/org/apache/daffodil/lib/testEquality/TestEqualityOperators.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class TestEqualityOperators {
4343
}
4444

4545
// prevent optimizations from using constant objects
46-
val xObj = if (scala.math.random == -0.0) "foo" else "bar"
47-
val yObj = if (scala.math.random == -0.0) "bar" else "foo"
46+
val xObj = if (scala.math.random() == -0.0) "foo" else "bar"
47+
val yObj = if (scala.math.random() == -0.0) "bar" else "foo"
4848

4949
@Test
5050
def testStronglyTypedEqualityInlineAnyRef(): Unit = {

daffodil-lib/src/test/scala/org/apache/daffodil/lib/util/TestMaybeInlineForeach.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ final class TestMaybeInlineForeach {
9999
*/
100100
// @Test
101101
def testForeachVersusIfDefined(): Unit = {
102-
val foreachNanos: Double = time(testForeach)
103-
val ifDefinedNanos: Double = time(testIfDefined)
104-
val ifNullNanos: Double = time(testIfNull)
102+
val foreachNanos: Double = time(testForeach()).toDouble
103+
val ifDefinedNanos: Double = time(testIfDefined()).toDouble
104+
val ifNullNanos: Double = time(testIfNull()).toDouble
105105
//
106106
// if foreach is taking more than 4x the time of ifDefined, that's
107107
// what we expect if scala can't inline-away the function object allocation

daffodil-lib/src/test/scala/org/apache/daffodil/lib/util/TestXMLCatalogAndValidate.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import scala.xml.parsing.NoBindingFactoryAdapter
3535
import org.apache.daffodil.lib.exceptions.Assert
3636
import org.apache.daffodil.lib.util.Implicits.using
3737
import org.apache.daffodil.lib.xml.DaffodilSAXParserFactory
38+
import org.apache.daffodil.lib.xml.NS
3839
import org.apache.daffodil.lib.xml.NS.implicitNStoString
3940
import org.apache.daffodil.lib.xml.XMLUtils
4041

@@ -350,9 +351,9 @@ class SchemaAwareFactoryAdapter() extends NoBindingFactoryAdapter {
350351
// If we're the xs:schema node, then append attribute for _file_ as well.
351352
val nsURI = scope.getURI(pre)
352353
val isXSSchemaNode = (label == "schema" && nsURI != null &&
353-
(nsURI == XMLUtils.XSD_NAMESPACE))
354+
(NS(nsURI) == XMLUtils.XSD_NAMESPACE))
354355
val isTDMLTestSuiteNode = (label == "testSuite" && nsURI != null &&
355-
nsURI == XMLUtils.TDML_NAMESPACE)
356+
NS(nsURI) == XMLUtils.TDML_NAMESPACE)
356357
val isFileRootNode = isXSSchemaNode || isTDMLTestSuiteNode
357358

358359
// augment the scope with the dafint namespace binding but only

daffodil-lib/src/test/scala/org/apache/daffodil/lib/validation/TestValidatorsSPI.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ class TestValidatorsSPI {
5353
val v = f.make(XercesValidatorFactory.makeConfig(Seq(schema)))
5454
val r = v.validateXML(infoset)
5555

56-
assertTrue(r.warnings.isEmpty)
57-
assertTrue(r.errors.isEmpty)
56+
assertTrue(r.warnings().isEmpty)
57+
assertTrue(r.errors().isEmpty)
5858
}
5959

6060
@Test def testFailingValidator(): Unit = {
6161
val f = Validators.get(FailingValidator.name)
6262
val v = f.make(XercesValidatorFactory.makeConfig(Seq(schema)))
6363
val r = v.validateXML(infoset)
6464

65-
assertTrue(r.warnings.isEmpty)
66-
assertFalse(r.errors.isEmpty)
65+
assertTrue(r.warnings().isEmpty)
66+
assertFalse(r.errors().isEmpty)
6767

68-
assertEquals(r.errors.iterator().next().getMessage, "boom")
68+
assertEquals(r.errors().iterator().next().getMessage, "boom")
6969
}
7070
}

daffodil-lib/src/test/scala/org/apache/daffodil/lib/validation/TestXercesValidator.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TestXercesValidator {
2929
val v = f.make(XercesValidatorFactory.makeConfig(Seq(schema)))
3030
val r = v.validateXML(infoset)
3131

32-
assertTrue(r.warnings.isEmpty)
33-
assertTrue(r.errors.isEmpty)
32+
assertTrue(r.warnings().isEmpty)
33+
assertTrue(r.errors().isEmpty)
3434
}
3535
}

daffodil-lib/src/test/scala/org/apache/daffodil/lib/xml/test/unit/TestXMLUtils.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class TestXMLUtils {
254254
// somewhat fungible.
255255
//
256256
val parser = ConstructingParser.fromSource(scala.io.Source.fromString(xmlRaw), true)
257-
val xml = parser.document.docElem
257+
val xml = parser.document().docElem
258258
assertEquals(5, xml.child.length)
259259
assertFalse(xml.child.forall { _.isInstanceOf[Text] })
260260
assertTrue(xml.child(1).isInstanceOf[PCData])
@@ -290,7 +290,7 @@ class TestXMLUtils {
290290
// Constructing parser.
291291
//
292292
val parser = ConstructingParser.fromSource(scala.io.Source.fromString(xmlRaw), true)
293-
val xml = parser.document.docElem
293+
val xml = parser.document().docElem
294294
assertEquals(1, xml.child.length)
295295
assertTrue(xml.child(0).isInstanceOf[PCData])
296296
val res = XMLUtils.coalesceAdjacentTextNodes(xml.child)

daffodil-lib/src/test/scala/passera/test/UnsignedPerf.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ object UnsignedPerf {
3535
val t0 = System.nanoTime
3636
val r = body
3737
val t1 = System.nanoTime
38-
println((t1 - t0) / 1e3 + " us")
38+
println(((t1 - t0) / 1e3).toString + " us")
3939
r
4040
}
4141

0 commit comments

Comments
 (0)