Skip to content

Commit 2eb3fe8

Browse files
committed
Fix all Auto-Application Errors
- using scalafix - used `scalafixAll dependency:fix.scala213.ExplicitNonNullaryApply@org.scala-lang:scala-rewrites:0.1.5` - fixed some false positives DAFFODIL-2152
1 parent c9a5f78 commit 2eb3fe8

File tree

82 files changed

+432
-428
lines changed

Some content is hidden

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

82 files changed

+432
-428
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class JDOMInfosetParseResult(parseResult: ParseResult, output: JDOMInfosetOutput
369369
extends InfosetParseResult(parseResult) {
370370

371371
override def write(os: OutputStream): Unit = {
372-
new org.jdom2.output.XMLOutputter().output(output.getResult, os)
372+
new org.jdom2.output.XMLOutputter().output(output.getResult(), os)
373373
}
374374
}
375375

@@ -410,7 +410,7 @@ class ScalaXMLInfosetParseResult(parseResult: ParseResult, output: ScalaXMLInfos
410410

411411
override def write(os: OutputStream): Unit = {
412412
val writer = new java.io.OutputStreamWriter(os, StandardCharsets.UTF_8)
413-
scala.xml.XML.write(writer, output.getResult, "UTF-8", true, null)
413+
scala.xml.XML.write(writer, output.getResult(), "UTF-8", true, null)
414414
writer.flush()
415415
}
416416
}
@@ -461,7 +461,7 @@ class W3CDOMInfosetParseResult(parseResult: ParseResult, output: W3CDOMInfosetOu
461461
val tf = TransformerFactory.newInstance()
462462
val transformer = tf.newTransformer()
463463
val result = new StreamResult(os)
464-
val source = new DOMSource(output.getResult)
464+
val source = new DOMSource(output.getResult())
465465
transformer.transform(source, result)
466466
}
467467
}

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

+10-10
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ class Main(
12881288
if (loc.bitLimit0b.isDefined) {
12891289
(loc.bitLimit0b.get - loc.bitPos0b).toString
12901290
} else {
1291-
"at least " + (inStream.inputSource.knownBytesAvailable * 8)
1291+
"at least " + (inStream.inputSource.knownBytesAvailable() * 8)
12921292
}
12931293
Logger.log.error(
12941294
s"Left over data after consuming 0 bits while streaming. Stopped after consuming ${loc.bitPos0b} bit(s) with ${remainingBits} bit(s) remaining."
@@ -1309,7 +1309,7 @@ class Main(
13091309
val bitsAlreadyConsumed = (loc.bitPos0b % 8).toInt
13101310
val firstByteString = if (bitsAlreadyConsumed != 0) {
13111311
val bitsToDisplay = 8 - bitsAlreadyConsumed
1312-
val pbp = inStream.inputSource.position + 1
1312+
val pbp = inStream.inputSource.position() + 1
13131313
val firstByteBitArray = inStream.getByteArray(bitsToDisplay, finfo)
13141314
val fbs = firstByteBitArray(0).toBinaryString
13151315
.takeRight(8)
@@ -1325,8 +1325,8 @@ class Main(
13251325
f"\nLeft over data starts with partial byte. Left over data (Binary) at byte $pbp is: (0b$bits)"
13261326
dumpString
13271327
} else ""
1328-
val curBytePosition1b = inStream.inputSource.position + 1
1329-
val bytesAvailable = inStream.inputSource.knownBytesAvailable
1328+
val curBytePosition1b = inStream.inputSource.position() + 1
1329+
val bytesAvailable = inStream.inputSource.knownBytesAvailable()
13301330
val bytesLimit = math.min(8, bytesAvailable).toInt
13311331
val destArray = new Array[Byte](bytesLimit)
13321332
val destArrayFilled = inStream.inputSource.get(destArray, 0, bytesLimit)
@@ -1684,23 +1684,23 @@ class Main(
16841684
.flatMap(testName => {
16851685
if (testOpts.regex()) {
16861686
val regex = testName.r
1687-
val matches = tdmlRunner.testCases.filter(testCase =>
1688-
regex.pattern.matcher(testCase.tcName).matches
1689-
)
1687+
val matches = tdmlRunner
1688+
.testCases()
1689+
.filter(testCase => regex.pattern.matcher(testCase.tcName).matches)
16901690
matches match {
16911691
case m if !m.isEmpty => m.map(testCase => (testCase.tcName, Some(testCase)))
16921692
case _ => Seq((testName, None))
16931693
}
16941694
} else {
1695-
List((testName, tdmlRunner.testCases.find(_.tcName == testName)))
1695+
List((testName, tdmlRunner.testCases().find(_.tcName == testName)))
16961696
}
16971697
})
16981698
} else {
1699-
tdmlRunner.testCases.map(test => (test.tcName, Some(test)))
1699+
tdmlRunner.testCases().map(test => (test.tcName, Some(test)))
17001700
}
17011701
}.distinct.sortBy(_._1)
17021702

1703-
tdmlRunner.reset
1703+
tdmlRunner.reset()
17041704

17051705
if (testOpts.list()) {
17061706
if (testOpts.info() > 0) {

daffodil-cli/src/main/scala/org/apache/daffodil/cli/debugger/CLIDebuggerRunner.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class CLIDebuggerRunner(cmdsIter: Iterator[String], in: InputStream, out: PrintS
4444
}
4545

4646
def this(file: File, in: InputStream, out: PrintStream) = {
47-
this(Source.fromFile(file).getLines, in, out)
47+
this(Source.fromFile(file).getLines(), in, out)
4848
}
4949

5050
def this(seq: Seq[String], in: InputStream, out: PrintStream) = {
@@ -80,7 +80,7 @@ class CLIDebuggerRunner(cmdsIter: Iterator[String], in: InputStream, out: PrintS
8080

8181
def getCommand: String = {
8282
val cmd = if (cmdsIter.hasNext) {
83-
val line = cmdsIter.next
83+
val line = cmdsIter.next()
8484
if (line.length > 0) {
8585
reader.get.getHistory.add(line)
8686
}

daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/DFDLDefineVariable.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class DFDLDefineVariable private (node: Node, doc: SchemaDocument)
101101
this.SDE("Variables must have primitive type. Type was '%s'.", typeQName.toPrettyString)
102102
)
103103

104-
final def createVariableInstance = variableRuntimeData.createVariableInstance
104+
final def createVariableInstance = variableRuntimeData.createVariableInstance()
105105
}
106106

107107
sealed abstract class VariableReference(node: Node, decl: AnnotatedSchemaComponent)

daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/GlobalElementDecl.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final class GlobalElementDecl private (xmlArg: Node, schemaDocument: SchemaDocum
3838

3939
lazy val asRoot = Root(xml, schemaDocument, namedQName, this)
4040

41-
requiredEvaluationsIfActivated(validateChoiceBranchKey)
41+
requiredEvaluationsIfActivated(validateChoiceBranchKey())
4242

4343
private def validateChoiceBranchKey(): Unit = {
4444
// Ensure that the global element decl does not have choiceBranchKey set.

daffodil-core/src/main/scala/org/apache/daffodil/core/util/TestUtils.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ object TestUtils {
203203
val input = InputSourceDataInputStream(is)
204204
val actual = p.parse(input, outputter)
205205
if (actual.isProcessingError) throwDiagnostics(actual.getDiagnostics)
206-
(actual, outputter.getResult)
206+
(actual, outputter.getResult())
207207
}
208208

209209
private val defaultIncludeImports =
@@ -425,7 +425,7 @@ class StreamParser private (val schema: Node) {
425425
val procErr = res.isProcessingError
426426
val validationErr = res.isValidationError
427427
val diags = res.getDiagnostics
428-
val doc = if (!procErr) outputter.getResult else null
428+
val doc = if (!procErr) outputter.getResult() else null
429429
val bitPos1b = res.resultState.currentLocation.bitPos1b
430430
val r = new StreamParser.Result(doc, diags, procErr, validationErr, bitPos1b)
431431
outputter.reset()

daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestExternalVariables.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,13 @@ class TestExternalVariables {
365365
)
366366

367367
val res1 = dp1.parse(input, outputter)
368-
assertTrue(outputter.getResult.toString.contains("default1"))
368+
assertTrue(outputter.getResult().toString.contains("default1"))
369369

370370
val res2 = dp2.parse(input, outputter)
371-
assertTrue(outputter.getResult.toString.contains("value1"))
371+
assertTrue(outputter.getResult().toString.contains("value1"))
372372

373373
val res3 = dp1.parse(input, outputter)
374-
assertTrue(outputter.getResult.toString.contains("default1"))
374+
assertTrue(outputter.getResult().toString.contains("default1"))
375375

376376
checkResult(dp1.variableMap, "{http://example.com}var1", "default1")
377377
checkResult(dp2.variableMap, "{http://example.com}var1", "value1")

0 commit comments

Comments
 (0)