fix warning. prepare Scala 3

This commit is contained in:
xuwei-k 2021-11-17 11:54:50 +09:00 committed by kenji yoshida
parent f4cd994ab4
commit 3ca1898721
14 changed files with 19 additions and 21 deletions

View File

@ -15,7 +15,7 @@ private[sbt] object JsonUtil {
log: Logger
): UpdateReport = {
try {
val lite = CacheStore(path).read[UpdateReportLite]
val lite = CacheStore(path).read[UpdateReportLite]()
fromLite(lite, cachedDescriptor)
} catch {
case e: Throwable =>

View File

@ -35,7 +35,7 @@ object UpdateClassifiersUtil {
classifiers: Vector[String],
exclude: Map[ModuleID, Set[ConfigRef]]
)(m: ModuleID): Option[ModuleID] = {
val excluded: Set[ConfigRef] = exclude getOrElse (restrictedCopy(m, false), Set.empty)
val excluded: Set[ConfigRef] = exclude.getOrElse(restrictedCopy(m, false), Set.empty)
val exls = excluded map { _.name }
val included = classifiers filterNot exls
if (included.isEmpty) None

View File

@ -18,7 +18,7 @@ object VersionRange {
// See https://github.com/sbt/sbt/issues/2954
def stripMavenVersionRange(version: String): Option[String] =
if (isVersionRange(version)) {
val noSpace = version.replaceAllLiterally(" ", "")
val noSpace = version.replace(" ", "")
noSpace match {
case MavenVersionSetPattern(open1, x1, comma, x2, close1, _) =>
// http://maven.apache.org/components/enforcer/enforcer-rules/versionRanges.html
@ -64,7 +64,7 @@ object VersionRange {
val start = rev(0)
val stop = rev(rev.length - 1)
val mid = rev.substring(1, rev.length - 1)
(if (start == ']') "(" else start) + mid + (if (stop == '[') ")" else stop)
(if (start == ']') "(" else start.toString) + mid + (if (stop == '[') ")" else stop)
case _ => revision
}
} catch {

View File

@ -130,7 +130,7 @@ object EvictionError {
)
}
implicit val evictionErrorLines: ShowLines[EvictionError] = ShowLines { a: EvictionError =>
implicit val evictionErrorLines: ShowLines[EvictionError] = ShowLines { (a: EvictionError) =>
a.toLines
}
}

View File

@ -208,7 +208,7 @@ final class EvictionPair private[sbt] (
}
object EvictionPair {
implicit val evictionPairLines: ShowLines[EvictionPair] = ShowLines { a: EvictionPair =>
implicit val evictionPairLines: ShowLines[EvictionPair] = ShowLines { (a: EvictionPair) =>
val revs = a.evicteds map { _.module.revision }
val revsStr = if (revs.size <= 1) revs.mkString else "{" + revs.mkString(", ") + "}"
val seen: mutable.Set[ModuleID] = mutable.Set()

View File

@ -59,7 +59,7 @@ private[librarymanagement] abstract class ModuleIDExtra {
/** String representation of the extra attributes, excluding any information only attributes. */
def extraString: String =
extraDependencyAttributes.map { case (k, v) => k + "=" + v } mkString ("(", ", ", ")")
extraDependencyAttributes.map { case (k, v) => k + "=" + v }.mkString("(", ", ", ")")
/** Returns the extra attributes except for ones marked as information only (ones that typically would not be used for dependency resolution). */
def extraDependencyAttributes: Map[String, String] =

View File

@ -38,7 +38,7 @@ object UnresolvedWarning {
} map {
case (_, p) => p
}
val failedPaths = err.failed map { x: ModuleID =>
val failedPaths = err.failed map { (x: ModuleID) =>
err.failedPaths(x).toList.reverse map { id =>
(id, modulePosition(id))
}

View File

@ -433,11 +433,11 @@ final class IvySbt(
unionFormat2[IvyConfiguration, InlineIvyConfiguration, ExternalIvyConfiguration]
object NullLogger extends sbt.internal.util.BasicLogger {
override def control(event: sbt.util.ControlEvent.Value, message: String): Unit = ()
override def log(level: Level.Value, message: String): Unit = ()
override def control(event: sbt.util.ControlEvent.Value, message: => String): Unit = ()
override def log(level: Level.Value, message: => String): Unit = ()
override def logAll(events: Seq[sbt.util.LogEvent]): Unit = ()
override def success(message: String): Unit = ()
override def trace(t: Throwable): Unit = ()
override def success(message: => String): Unit = ()
override def trace(t: => Throwable): Unit = ()
}
}

View File

@ -396,7 +396,7 @@ object IvyActions {
val toRetrieve: Option[Vector[ConfigRef]] = config.configurationsToRetrieve
val base = getRetrieveDirectory(config.retrieveDirectory)
val pattern = getRetrievePattern(config.outputPattern)
val existingFiles = PathFinder(base).allPaths.get filterNot { _.isDirectory }
val existingFiles = PathFinder(base).allPaths.get() filterNot { _.isDirectory }
val toCopy = new collection.mutable.HashSet[(File, File)]
val retReport = report retrieve { (conf: ConfigRef, mid, art, cached) =>
toRetrieve match {

View File

@ -8,7 +8,7 @@ import scala.util.{ Failure, Success, Try }
private[sbt] object IvyUtil {
def separate[A, B](l: Seq[Either[A, B]]): (Seq[A], Seq[B]) =
(l.flatMap(_.left.toOption), l.flatMap(_.right.toOption))
(l.flatMap(_.left.toOption), l.flatMap(_.toOption))
@tailrec
final def retryWithBackoff[T](

View File

@ -61,7 +61,7 @@ private[sbt] class CachedResolutionResolveCache {
val maxConflictCacheSize: Int = 1024
val maxUpdateReportCacheSize: Int = 1024
def clean(): Unit = updateReportCache.clear
def clean(): Unit = updateReportCache.clear()
def directDependencies(md0: ModuleDescriptor): Vector[DependencyDescriptor] =
md0.getDependencies.toVector
@ -699,11 +699,11 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
)
}
(if (n > guard) {
warnCircular
warnCircular()
result0
} else if (called.isEmpty) result0
else if (notCalled.isEmpty) {
warnCircular
warnCircular()
sortModules(cs.tail, acc, extra :+ cs.head, n + 1, guard)
} else sortModules(called, acc ++ notCalled, extra, 0, called.size * called.size + 1))
}

View File

@ -92,7 +92,7 @@ final class DirectCredentials(
val dq = '"'
val r =
if (realm == null) "null"
else dq + realm + dq
else s"$dq$realm$dq"
s"""DirectCredentials($r, "$host", "$userName", ****)"""
}
}

View File

@ -102,7 +102,7 @@ trait BaseIvySpecification extends AbstractEngineSpec {
}
}
def cleanCache: Unit = cleanIvyCache()
def cleanCache(): Unit = cleanIvyCache()
def cleanIvyCache(): Unit = IO.delete(currentTarget / "cache")
override def cleanCachedResolutionCache(module: ModuleDescriptor): Unit = {

View File

@ -1,7 +1,5 @@
package sbt.internal.librarymanagement
import java.io.File
import org.apache.ivy.util.Message
import sbt.librarymanagement._
import sbt.librarymanagement.ivy._