Skip to content

Commit f7b16e9

Browse files
committed
Cleanup multiple depreacted collection API calls
1 parent 638fde1 commit f7b16e9

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

scalac-scoverage-plugin/src/main/scala/scoverage/plugin.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@ class ScoveragePlugin(val global: Global) extends Plugin {
1818
val instrumentationComponent = new ScoverageInstrumentationComponent(global, extraAfterPhase, extraBeforePhase)
1919
override val components: List[PluginComponent] = List(instrumentationComponent)
2020

21+
private def parseExclusionEntry(entryName: String, inOption: String): Seq[String] =
22+
inOption.substring(entryName.length).split(";").map(_.trim).toIndexedSeq.filterNot(_.isEmpty)
23+
2124
override def processOptions(opts: List[String], error: String => Unit): Unit = {
2225
val options = new ScoverageOptions
26+
2327
for (opt <- opts) {
2428
if (opt.startsWith("excludedPackages:")) {
25-
options.excludedPackages = opt.substring("excludedPackages:".length).split(";").map(_.trim).filterNot(_.isEmpty)
29+
options.excludedPackages = parseExclusionEntry("excludedPackages", opt)
2630
} else if (opt.startsWith("excludedFiles:")) {
27-
options.excludedFiles = opt.substring("excludedFiles:".length).split(";").map(_.trim).filterNot(_.isEmpty)
31+
options.excludedFiles = parseExclusionEntry("excludedFiles", opt)
2832
} else if (opt.startsWith("excludedSymbols:")) {
29-
options.excludedSymbols = opt.substring("excludedSymbols:".length).split(";").map(_.trim).filterNot(_.isEmpty)
33+
options.excludedSymbols = parseExclusionEntry("excludedSymbols", opt)
3034
} else if (opt.startsWith("dataDir:")) {
3135
options.dataDir = opt.substring("dataDir:".length)
3236
} else if (opt.startsWith("extraAfterPhase:") || opt.startsWith("extraBeforePhase:")) {

scalac-scoverage-plugin/src/test/scala/scoverage/IOUtilsTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class IOUtilsTest extends FreeSpec with MockitoSugar with OneInstancePerTest wit
3636
writer2.close()
3737

3838
val files = IOUtils.findMeasurementFiles(file1.getParent)
39-
val invoked = IOUtils.invoked(files)
39+
val invoked = IOUtils.invoked(files.toIndexedSeq)
4040
assert(invoked.toSet === Set(1, 2, 5, 7, 9, 10, 14))
4141

4242
file1.delete()

scalac-scoverage-runtime/shared/src/test/scala/scoverage/InvokerMultiModuleTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ class InvokerMultiModuleTest extends FunSuite with BeforeAndAfter {
2727

2828
// Verify measurements went to correct directory
2929
val measurementFiles0 = Invoker.findMeasurementFiles(measurementDir(0))
30-
val idsFromFile0 = Invoker.invoked(measurementFiles0).toSet
30+
val idsFromFile0 = Invoker.invoked(measurementFiles0.toIndexedSeq).toSet
3131

3232
idsFromFile0 === testIds.filter { i: Int => i % 2 == 0 }
3333

3434
val measurementFiles1 = Invoker.findMeasurementFiles(measurementDir(0))
35-
val idsFromFile1 = Invoker.invoked(measurementFiles1).toSet
35+
val idsFromFile1 = Invoker.invoked(measurementFiles1.toIndexedSeq).toSet
3636
idsFromFile1 === testIds.filter { i: Int => i % 2 == 1 }
3737
}
3838

0 commit comments

Comments
 (0)