Skip to content

Commit 182356e

Browse files
authored
Merge pull request #549 from lukaszwawrzyk/warnings-cleanup
Some warnings cleanup
2 parents ae02d7e + 08fb864 commit 182356e

15 files changed

Lines changed: 28 additions & 24 deletions

File tree

internal/compiler-bridge/src/main/scala/xsbt/InteractiveConsoleInterface.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ class InteractiveConsoleInterface(
4040
val poutWriter: PrintWriter = new PrintWriter(outWriter)
4141

4242
val interpreter: IMain =
43-
new IMain(compilerSettings, replReporter(compilerSettings, new PrintWriter(outWriter))) {
44-
def lastReq: Request = prevRequestList.last
45-
}
43+
new IMain(compilerSettings, replReporter(compilerSettings, new PrintWriter(outWriter)))
4644

4745
def interpret(line: String, synthetic: Boolean): InteractiveConsoleResponse = {
4846
clearBuffer()

internal/compiler-bridge/src/main/scala_2.13/xsbt/ConsoleInterface.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ package xsbt
1010
import xsbti.Logger
1111
import scala.tools.nsc.interpreter.IMain
1212
import scala.tools.nsc.interpreter.shell.{ ILoop, ShellConfig, ReplReporterImpl }
13-
import scala.tools.nsc.reporters.Reporter
1413
import scala.tools.nsc.{ GenericRunnerCommand, Settings }
1514

1615
class ConsoleInterface {
@@ -52,8 +51,12 @@ class ConsoleInterface {
5251
} else
5352
super.createInterpreter(interpreterSettings)
5453

55-
for ((id, value) <- bindNames zip bindValues)
56-
intp.beQuietDuring(intp.bind(id, value.asInstanceOf[AnyRef].getClass.getName, value))
54+
for ((id, value) <- bindNames zip bindValues) {
55+
intp.beQuietDuring {
56+
intp.bind(id, value.asInstanceOf[AnyRef].getClass.getName, value)
57+
()
58+
}
59+
}
5760

5861
if (!initialCommands.isEmpty)
5962
intp.interpret(initialCommands)
@@ -69,6 +72,7 @@ class ConsoleInterface {
6972
}
7073

7174
loop.run(compilerSettings)
75+
()
7276
}
7377
}
7478

internal/zinc-benchmarks/src/main/scala/xsbt/ZincBenchmark.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import sbt.internal.util.ConsoleLogger
1414
import sbt.io.{ IO, RichFile }
1515
import xsbt.ZincBenchmark.CompilationInfo
1616
import xsbti._
17-
import xsbti.compile.{ IncOptions, SingleOutput }
17+
import xsbti.compile.SingleOutput
1818

1919
import scala.util.Try
2020

@@ -352,6 +352,7 @@ case class BenchmarkProject(
352352
gitClient.right.flatMap(Git.checkout(_, hash)).right.map(_ => tempDir)
353353
}
354354

355+
// Left for compatibility
355356
import ZincBenchmark.TryEnrich
356357
def writeBuildInfo(projectDir: File, sharedDir: File): WriteBuildInfo = {
357358
def persistBuildInfo(subproject: String, stateFile: File): Result[Unit] = {

internal/zinc-classpath/src/main/scala/sbt/internal/inc/classpath/ClasspathUtilities.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ object ClasspathUtilities {
118118

119119
/** Returns all entries in 'classpath' that correspond to a compiler plugin.*/
120120
private[sbt] def compilerPlugins(classpath: Seq[File], isDotty: Boolean): Iterable[File] = {
121-
import collection.JavaConversions._
121+
import collection.JavaConverters._
122122
val loader = new URLClassLoader(Path.toURLs(classpath))
123123
val metaFile = if (isDotty) "plugin.properties" else "scalac-plugin.xml"
124-
loader.getResources(metaFile).toList.flatMap(asFile(true))
124+
loader.getResources(metaFile).asScala.toList.flatMap(asFile(true))
125125
}
126126

127127
/** Converts the given URL to a File. If the URL is for an entry in a jar, the File for the jar is returned. */

internal/zinc-compile-core/src/main/scala/sbt/internal/inc/FilteredReporter.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class FilteredReporter(
8888
val transformedPos: Position = positionMapper(position)
8989
val problem = InterfaceUtil.problem(category, transformedPos, message, severity)
9090
allProblems += problem
91+
()
9192
}
9293
}
9394
}

internal/zinc-compile-core/src/main/scala/sbt/internal/inc/ReporterManager.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import sbt.util.LogExchange
1616
import sbt.util.{ Level => SbtLevel }
1717
import xsbti.{ Position, Reporter, ReporterConfig }
1818

19-
import scala.util.matching.Regex
20-
2119
object ReporterManager {
2220
import java.util.concurrent.atomic.AtomicInteger
2321
private val idGenerator: AtomicInteger = new AtomicInteger
@@ -75,8 +73,6 @@ object ReporterManager {
7573
case _ => new LoggedReporter(maxErrors, logger, posMapper)
7674
}
7775
} else {
78-
implicit def scalaPatterns(patterns: Array[java.util.regex.Pattern]): Array[Regex] =
79-
patterns.map(_.pattern().r)
8076
val fileFilters = config.fileFilters().map(_.toScala)
8177
val msgFilters = config.msgFilters().map(_.toScala)
8278
logger match {

internal/zinc-compile-core/src/main/scala/sbt/internal/inc/javac/JavacProcessLogger.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import scala.sys.process.ProcessLogger
2727
* @param cwd The current working directory of the Javac process, used when parsing Filenames.
2828
*/
2929
final class JavacLogger(log: sbt.util.Logger, reporter: Reporter, cwd: File) extends ProcessLogger {
30-
private var out: ListBuffer[String] = new ListBuffer()
31-
private var err: ListBuffer[String] = new ListBuffer()
30+
private val out: ListBuffer[String] = new ListBuffer()
31+
private val err: ListBuffer[String] = new ListBuffer()
3232

3333
def out(s: => String): Unit =
3434
synchronized {

internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class JavaProcessLoggerSpec extends UnitSpec {
3434

3535
errorLogger.messages shouldBe Map.empty
3636
reporter.problems.length shouldBe 2
37+
()
3738
}
3839

3940
def logSeparateSemanticErrors(): Unit = {
@@ -56,6 +57,7 @@ class JavaProcessLoggerSpec extends UnitSpec {
5657

5758
errorLogger.messages shouldBe Map.empty
5859
reporter.problems.length shouldBe 2
60+
()
5961
}
6062

6163
def logUnparsableErrors(): Unit = {
@@ -71,5 +73,6 @@ class JavaProcessLoggerSpec extends UnitSpec {
7173
.messages(Level.Warn)(0)
7274
.contains("javadoc: error - invalid flag: -target") shouldBe true
7375
errorLogger.messages(Level.Warn)(1).contains("javadoc exited with exit code -1") shouldBe true
76+
()
7477
}
7578
}

internal/zinc-core/src/main/scala/sbt/internal/inc/APIDiff.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private[inc] class APIDiff {
7272
private final val DELETION_COLOR = ANSI_RED
7373
private final val ADDITION_COLOR = ANSI_GREEN
7474

75-
@tailrec private def splitTokens(str: String, acc: List[String] = Nil): List[String] = {
75+
@tailrec private def splitTokens(str: String, acc: List[String]): List[String] = {
7676
if (str == "") {
7777
acc.reverse
7878
} else {
@@ -165,8 +165,10 @@ private[inc] class APIDiff {
165165
def build(x: Array[String], y: Array[String], builder: mutable.ArrayBuilder[Patch]): Unit = {
166166
if (x.isEmpty) {
167167
builder += Inserted(y.mkString)
168+
()
168169
} else if (y.isEmpty) {
169170
builder += Deleted(x.mkString)
171+
()
170172
} else if (x.length == 1 || y.length == 1) {
171173
needlemanWunsch(x, y, builder)
172174
} else {
@@ -251,6 +253,7 @@ private[inc] class APIDiff {
251253
}
252254
}
253255
builder ++= alignment
256+
()
254257
}
255258

256259
}

internal/zinc-core/src/main/scala/sbt/internal/inc/MemberRefInvalidator.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private[inc] class MemberRefInvalidator(log: Logger, logRecompileOnMacro: Boolea
5959
new InvalidateUnconditionally(memberRef)
6060
case NamesChange(_, modifiedNames) if modifiedNames.in(UseScope.Implicit).nonEmpty =>
6161
new InvalidateUnconditionally(memberRef)
62-
case NamesChange(modifiedClass, modifiedNames) =>
62+
case NamesChange(_, modifiedNames) =>
6363
new NameHashFilteredInvalidator(usedNames, memberRef, modifiedNames, isScalaClass)
6464
}
6565

@@ -77,6 +77,7 @@ private[inc] class MemberRefInvalidator(log: Logger, logRecompileOnMacro: Boolea
7777
}
7878
}
7979

80+
// Left for compatibility
8081
private class InvalidateDueToMacroDefinition(memberRef: Relation[String, String])
8182
extends (String => Set[String]) {
8283
def apply(from: String): Set[String] = {

0 commit comments

Comments
 (0)