Merge pull request #7812 from xuwei-k/private-this

[2.x] `private[this]` => `private`
This commit is contained in:
eugene yokota 2024-10-22 23:24:53 -04:00 committed by GitHub
commit 009174a21b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 114 additions and 114 deletions

View File

@ -43,7 +43,7 @@ private[librarymanagement] abstract class SemSelAndChunkFunctions {
SemSelAndChunk(comparators.flatMap(_.expandWildcard))
}
private[this] def hasOperator(comparator: String): Boolean = {
private def hasOperator(comparator: String): Boolean = {
comparator.startsWith("<") ||
comparator.startsWith(">") ||
comparator.startsWith("=")
@ -103,7 +103,7 @@ private[librarymanagement] abstract class SemComparatorExtra {
case _ => false
}
}
private[this] def comparePreReleaseTags(ts1: Seq[String], ts2: Seq[String]): Int = {
private def comparePreReleaseTags(ts1: Seq[String], ts2: Seq[String]): Int = {
// > When major, minor, and patch are equal, a pre-release version has lower precedence than a normal version.
if (ts1.isEmpty && ts2.isEmpty) 0
else if (ts1.nonEmpty && ts2.isEmpty) -1 // ts1 is pre-release version
@ -112,7 +112,7 @@ private[librarymanagement] abstract class SemComparatorExtra {
}
@tailrec
private[this] def compareTags(ts1: Seq[String], ts2: Seq[String]): Int = {
private def compareTags(ts1: Seq[String], ts2: Seq[String]): Int = {
// > A larger set of pre-release fields has a higher precedence than a smaller set,
// > if all of the preceding identifiers are equal.
if (ts1.isEmpty && ts2.isEmpty) 0
@ -143,7 +143,7 @@ private[librarymanagement] abstract class SemComparatorExtra {
}
private[librarymanagement] abstract class SemComparatorFunctions {
private[this] val ComparatorRegex = """(?x)^
private val ComparatorRegex = """(?x)^
([<>]=?|=)?
(?:(\d+|[xX*])
(?:\.(\d+|[xX*])
@ -209,8 +209,8 @@ private[librarymanagement] abstract class SemComparatorFunctions {
case _ => throw new IllegalArgumentException(s"Invalid comparator: $comparator")
}
}
private[this] def splitOn[A](s: String, sep: Char): Vector[String] =
private def splitOn[A](s: String, sep: Char): Vector[String] =
if (s eq null) Vector()
else s.split(sep).filterNot(_ == "").toVector
private[this] def splitDash(s: String) = splitOn(s, '-')
private def splitDash(s: String) = splitOn(s, '-')
}

View File

@ -80,8 +80,8 @@ object VersionRange {
if (version.length <= 1) false
else startSym(version(0)) && stopSym(version(version.length - 1))
private[this] val startSym = Set(']', '[', '(')
private[this] val stopSym = Set(']', '[', ')')
private[this] val MavenVersionSetPattern =
private val startSym = Set(']', '[', '(')
private val stopSym = Set(']', '[', ')')
private val MavenVersionSetPattern =
"""([\]\[\(])([\w\.\-]+)?(,)?([\w\.\-]+)?([\]\[\)])(,.+)?""".r
}

View File

@ -125,10 +125,10 @@ object CrossVersionUtil {
case _ => full
}
private[this] def isNewer(major: Long, minor: Long, minMajor: Long, minMinor: Long): Boolean =
private def isNewer(major: Long, minor: Long, minMajor: Long, minMinor: Long): Boolean =
major > minMajor || (major == minMajor && minor >= minMinor)
private[this] def binaryVersionWithApi(full: String, cutoff: String)(
private def binaryVersionWithApi(full: String, cutoff: String)(
apiVersion: String => Option[(Long, Long)]
): String = {
(apiVersion(full), partialVersion(cutoff)) match {

View File

@ -22,7 +22,7 @@ final class ConfigRef private (val name: String) extends Serializable {
name
}
private[this] def copy(name: String = name): ConfigRef = {
private def copy(name: String = name): ConfigRef = {
ConfigRef(name)
}

View File

@ -35,7 +35,7 @@ final class Configuration private[sbt] (
override def toString: String = name
private[this] def copy(
private def copy(
id: String = id,
name: String = name,
description: String = description,

View File

@ -11,14 +11,14 @@ final case class ConflictWarning(label: String, level: Level.Value, failOnConfli
object ConflictWarning {
def disable: ConflictWarning = ConflictWarning("", Level.Debug, false)
private[this] def idString(org: String, name: String) = s"$org:$name"
private def idString(org: String, name: String) = s"$org:$name"
def default(label: String): ConflictWarning = ConflictWarning(label, Level.Error, true)
def apply(config: ConflictWarning, report: UpdateReport, log: Logger): Unit = {
processCrossVersioned(config, report, log)
}
private[this] def processCrossVersioned(
private def processCrossVersioned(
config: ConflictWarning,
report: UpdateReport,
log: Logger
@ -51,20 +51,20 @@ object ConflictWarning {
}
mismatches.foldLeft(Map.empty[(String, String), Set[String]])(merge)
}
private[this] def merge[A, B](m: Map[A, Set[B]], b: (A, Set[B])): Map[A, Set[B]] =
private def merge[A, B](m: Map[A, Set[B]], b: (A, Set[B])): Map[A, Set[B]] =
if (b._2.isEmpty) m
else
m.updated(b._1, m.getOrElse(b._1, Set.empty) ++ b._2)
private[this] def groupByRawName(ms: Seq[ModuleID]): Map[(String, String), Seq[ModuleID]] =
private def groupByRawName(ms: Seq[ModuleID]): Map[(String, String), Seq[ModuleID]] =
ms.groupBy(m => (m.organization, dropCrossSuffix(m.name)))
private[this] val CrossSuffixPattern = """(.+)_(\d+(?:\.\d+)?(?:\.\d+)?(?:-.+)?)""".r
private[this] def dropCrossSuffix(s: String): String = s match {
private val CrossSuffixPattern = """(.+)_(\d+(?:\.\d+)?(?:\.\d+)?(?:-.+)?)""".r
private def dropCrossSuffix(s: String): String = s match {
case CrossSuffixPattern(raw, _) => raw
case _ => s
}
private[this] def getCrossSuffix(s: String): String = s match {
private def getCrossSuffix(s: String): String = s match {
case CrossSuffixPattern(_, v) => "_" + v
case _ => "<none>"
}

View File

@ -33,7 +33,7 @@ sealed class Disabled private () extends sbt.librarymanagement.CrossVersion() wi
override def toString: String = {
"Disabled()"
}
private[this] def copy(): Disabled = {
private def copy(): Disabled = {
new Disabled()
}
@ -64,7 +64,7 @@ final class Binary private (val prefix: String, val suffix: String)
override def toString: String = {
"Binary(" + prefix + ", " + suffix + ")"
}
private[this] def copy(prefix: String = prefix, suffix: String = suffix): Binary = {
private def copy(prefix: String = prefix, suffix: String = suffix): Binary = {
new Binary(prefix, suffix)
}
def withPrefix(prefix: String): Binary = {
@ -97,7 +97,7 @@ final class Constant private (val value: String)
override def toString: String = {
"Constant(" + value + ")"
}
private[this] def copy(value: String = value): Constant = {
private def copy(value: String = value): Constant = {
new Constant(value)
}
def withValue(value: String): Constant = {
@ -125,7 +125,7 @@ final class Patch private () extends sbt.librarymanagement.CrossVersion() with S
override def toString: String = {
"Patch()"
}
private[this] def copy(): Patch = {
private def copy(): Patch = {
new Patch()
}
}
@ -156,7 +156,7 @@ final class Full private (val prefix: String, val suffix: String)
override def toString: String = {
"Full(" + prefix + ", " + suffix + ")"
}
private[this] def copy(prefix: String = prefix, suffix: String = suffix): Full = {
private def copy(prefix: String = prefix, suffix: String = suffix): Full = {
new Full(prefix, suffix)
}
def withPrefix(prefix: String): Full = {
@ -194,7 +194,7 @@ final class For3Use2_13 private (val prefix: String, val suffix: String)
override def toString: String = {
"For3Use2_13(" + prefix + ", " + suffix + ")"
}
private[this] def copy(prefix: String = prefix, suffix: String = suffix): For3Use2_13 = {
private def copy(prefix: String = prefix, suffix: String = suffix): For3Use2_13 = {
new For3Use2_13(prefix, suffix)
}
def withPrefix(prefix: String): For3Use2_13 = {
@ -232,7 +232,7 @@ final class For2_13Use3 private (val prefix: String, val suffix: String)
override def toString: String = {
"For3Use2_13(" + prefix + ", " + suffix + ")"
}
private[this] def copy(prefix: String = prefix, suffix: String = suffix): For2_13Use3 = {
private def copy(prefix: String = prefix, suffix: String = suffix): For2_13Use3 = {
new For2_13Use3(prefix, suffix)
}
def withPrefix(prefix: String): For2_13Use3 = {

View File

@ -83,7 +83,7 @@ sealed trait SubDepFilter[Arg, Self <: SubDepFilter[Arg, Self]] extends Dependen
final def &(o: Self): Self = combine(o, _ && _)
final def |(o: Self): Self = combine(o, _ || _)
final def -(o: Self): Self = combine(o, _ && !_)
private[this] def combine(o: Self, f: (Boolean, Boolean) => Boolean): Self =
private def combine(o: Self, f: (Boolean, Boolean) => Boolean): Self =
make((m: Arg) => f(this(m), o(m)))
}
trait ModuleFilter extends SubDepFilter[ModuleID, ModuleFilter] {

View File

@ -424,7 +424,7 @@ private[librarymanagement] abstract class ResolverFunctions {
)
}
private[this] def mavenLocalDir: File = {
private def mavenLocalDir: File = {
def loadHomeFromSettings(f: () => File): Option[File] =
try {
val file = f()

View File

@ -49,7 +49,7 @@ final class RichUpdateReport(report: UpdateReport) {
def select(artifact: ArtifactFilter): Vector[File] =
select(configurationFilter(), moduleFilter(), artifact)
private[this] def select0(f: DependencyFilter): Vector[File] =
private def select0(f: DependencyFilter): Vector[File] =
for {
cReport <- report.configurations
mReport <- cReport.modules

View File

@ -100,7 +100,7 @@ object ScalaArtifacts {
scala2ToolDependency(org, LibraryID, version)
)
private[this] def scala2ToolDependency(org: String, id: String, version: String): ModuleID =
private def scala2ToolDependency(org: String, id: String, version: String): ModuleID =
ModuleID(org, id, version)
.withConfigurations(
Some(Configurations.ScalaTool.name + "->default,optional(default)")

View File

@ -20,7 +20,7 @@ private[librarymanagement] abstract class ConfigurationReportExtra {
* For a given organization and module name, there is only one revision/`ModuleID` in this sequence.
*/
def allModules: Seq[ModuleID] = modules map addConfiguration
private[this] def addConfiguration(mr: ModuleReport): ModuleID = {
private def addConfiguration(mr: ModuleReport): ModuleID = {
val module = mr.module
if (module.configurations.isEmpty) {
val conf = mr.configurations map (c => s"$configuration->$c") mkString ";"
@ -60,7 +60,7 @@ private[librarymanagement] abstract class ModuleReportExtra {
def withArtifacts(artifacts: Vector[(Artifact, File)]): ModuleReport
protected[this] def arts: Vector[String] =
protected def arts: Vector[String] =
artifacts.map(_.toString) ++ missingArtifacts.map(art => "(MISSING) " + art)
def detailReport: String =
@ -110,7 +110,7 @@ private[librarymanagement] abstract class ModuleReportExtra {
s"\t\t\t$key: $x\n"
} getOrElse ""
private[this] def calendarToString(c: ju.Calendar): String = {
private def calendarToString(c: ju.Calendar): String = {
import sjsonnew._, BasicJsonProtocol._
implicitly[IsoString[ju.Calendar]] to c
}

View File

@ -32,7 +32,7 @@ final class VersionNumber private[sbt] (
}
/** A variant of mkString that returns the empty string if the sequence is empty. */
private[this] def mkString1[A](xs: Seq[A], start: String, sep: String, end: String): String =
private def mkString1[A](xs: Seq[A], start: String, sep: String, end: String): String =
if (xs.isEmpty) "" else xs.mkString(start, sep, end)
}
@ -140,7 +140,7 @@ object VersionNumber {
def isCompatible(v1: VersionNumber, v2: VersionNumber): Boolean =
doIsCompat(dropBuildMetadata(v1), dropBuildMetadata(v2))
private[this] def doIsCompat(v1: VersionNumber, v2: VersionNumber): Boolean =
private def doIsCompat(v1: VersionNumber, v2: VersionNumber): Boolean =
(v1, v2) match {
case (NormalVersion(0, _, _), NormalVersion(0, _, _)) => v1 == v2 // R4
case (NormalVersion(_, 0, 0), NormalVersion(_, 0, 0)) => v1 == v2 // R9 maybe?
@ -186,7 +186,7 @@ object VersionNumber {
def isCompatible(v1: VersionNumber, v2: VersionNumber): Boolean =
doIsCompat(dropBuildMetadata(v1), dropBuildMetadata(v2))
private[this] def doIsCompat(v1: VersionNumber, v2: VersionNumber): Boolean = {
private def doIsCompat(v1: VersionNumber, v2: VersionNumber): Boolean = {
(v1, v2) match {
case (NormalVersion(_, _, 0), NormalVersion(_, _, 0)) => v1 == v2 // R9 maybe?
case (NormalVersion(x1, y1, _), NormalVersion(x2, y2, _)) => (x1 == x2) && (y1 == y2)
@ -249,7 +249,7 @@ object VersionNumber {
def isCompatible(v1: VersionNumber, v2: VersionNumber): Boolean =
doIsCompat(dropBuildMetadata(v1), dropBuildMetadata(v2))
private[this] def doIsCompat(v1: VersionNumber, v2: VersionNumber): Boolean =
private def doIsCompat(v1: VersionNumber, v2: VersionNumber): Boolean =
(v1, v2) match {
case (NormalVersion(0, _, 0), NormalVersion(0, _, 0)) => v1 == v2
case (NormalVersion(0, y1, _), NormalVersion(0, y2, _)) => y1 == y2

View File

@ -372,27 +372,27 @@ class SemanticSelectorSpec extends AnyFreeSpec with Matchers {
}
}
private[this] final class SemanticSelectorString(val value: String)
private[this] def semsel(s: String)(f: SemanticSelectorString => Unit): Unit =
private final class SemanticSelectorString(val value: String)
private def semsel(s: String)(f: SemanticSelectorString => Unit): Unit =
s"""SemanticSelector "$s"""" - {
f(new SemanticSelectorString(s))
}
private[this] def assertMatches(
private def assertMatches(
s: SemanticSelectorString,
v: String
): Unit = s"""should match "$v"""" in {
SemanticSelector(s.value).matches(VersionNumber(v)) shouldBe true
}
private[this] def assertNotMatches(
private def assertNotMatches(
s: SemanticSelectorString,
v: String
): Unit = s"""should not match "$v"""" in {
SemanticSelector(s.value).matches(VersionNumber(v)) shouldBe false
}
private[this] def assertParsesToError(s: SemanticSelectorString): Unit =
private def assertParsesToError(s: SemanticSelectorString): Unit =
s"""should parse as an error""" in {
an[IllegalArgumentException] should be thrownBy SemanticSelector(s.value)
}

View File

@ -135,14 +135,14 @@ class VersionNumberSpec extends AnyFreeSpec with Matchers with Inside {
// //
private[this] final class VersionString(val value: String)
private final class VersionString(val value: String)
private[this] def version(s: String)(f: VersionString => Unit) =
private def version(s: String)(f: VersionString => Unit) =
s"""Version "$s"""" - {
f(new VersionString(s))
}
private[this] def assertParsesTo(
private def assertParsesTo(
v: VersionString,
ns: Seq[Long],
ts: Seq[String],
@ -156,14 +156,14 @@ class VersionNumberSpec extends AnyFreeSpec with Matchers with Inside {
(VersionNumber(ns, ts, es) shouldBe VersionNumber(ns, ts, es))
}
private[this] def assertParsesToError(v: VersionString): Unit =
private def assertParsesToError(v: VersionString): Unit =
"should parse as an error" in {
v.value should not matchPattern {
case s: String if VersionNumber.unapply(s).isDefined => // because of unapply overloading
}
}
private[this] def assertBreaksDownTo(
private def assertBreaksDownTo(
v: VersionString,
major: Option[Long],
minor: Option[Long] = None,
@ -179,28 +179,28 @@ class VersionNumberSpec extends AnyFreeSpec with Matchers with Inside {
(v._4 shouldBe buildNumber)
}
private[this] def assertCascadesTo(v: VersionString, ns: Seq[String]): Unit = {
private def assertCascadesTo(v: VersionString, ns: Seq[String]): Unit = {
s"should cascade to $ns" in {
val versionNumbers = ns.toVector map VersionNumber.apply
VersionNumber(v.value).cascadingVersions shouldBe versionNumbers
}
}
private[this] def assertIsCompatibleWith(
private def assertIsCompatibleWith(
v1: VersionString,
v2: String,
vnc: VersionNumberCompatibility
): Unit =
checkCompat(true, vnc, v1, v2)
private[this] def assertIsNotCompatibleWith(
private def assertIsNotCompatibleWith(
v1: VersionString,
v2: String,
vnc: VersionNumberCompatibility
): Unit =
checkCompat(false, vnc, v1, v2)
private[this] def checkCompat(
private def checkCompat(
expectOutcome: Boolean,
vnc: VersionNumberCompatibility,
v1: VersionString,

View File

@ -24,7 +24,7 @@ class ComponentManager(
ivyHome: Option[File],
val log: Logger
) {
private[this] val ivyCache = new IvyCache(ivyHome)
private val ivyCache = new IvyCache(ivyHome)
/** Get all of the files for component 'id', throwing an exception if no files exist for the component. */
def files(id: String)(ifMissing: IfMissing): Iterable[File] = {

View File

@ -385,9 +385,9 @@ private[sbt] object ConvertResolver {
* A custom Ivy URLRepository that returns FileResources for file URLs.
* This allows using the artifacts from the Maven local repository instead of copying them to the Ivy cache.
*/
private[this] final class LocalIfFileRepo extends URLRepo {
private[this] val repo = new WarnOnOverwriteFileRepo()
private[this] val progress = new RepositoryCopyProgressListener(this);
private final class LocalIfFileRepo extends URLRepo {
private val repo = new WarnOnOverwriteFileRepo()
private val progress = new RepositoryCopyProgressListener(this);
override def getResource(source: String) = {
val uri = new URI(source)
if (uri.getScheme == IO.FileScheme)
@ -446,7 +446,7 @@ private[sbt] object ConvertResolver {
}
}
private[this] final class WarnOnOverwriteFileRepo extends FileRepo() {
private final class WarnOnOverwriteFileRepo extends FileRepo() {
override def put(source: java.io.File, destination: String, overwrite: Boolean): Unit = {
try super.put(source, destination, overwrite)
catch {

View File

@ -73,7 +73,7 @@ object CustomPomParser {
val SbtVersionKey = PomExtraDependencyAttributes.SbtVersionKey
val ScalaVersionKey = PomExtraDependencyAttributes.ScalaVersionKey
val ExtraAttributesKey = PomExtraDependencyAttributes.ExtraAttributesKey
private[this] val unqualifiedKeys =
private val unqualifiedKeys =
Set(SbtVersionKey, ScalaVersionKey, ExtraAttributesKey, ApiURLKey, VersionSchemeKey)
/**
@ -107,20 +107,20 @@ object CustomPomParser {
val JarPackagings = Set("eclipse-plugin", "hk2-jar", "orbit", "scala-jar")
val default = new CustomPomParser(PomModuleDescriptorParser.getInstance, defaultTransform)
private[this] val TransformedHashKey = "e:sbtTransformHash"
private val TransformedHashKey = "e:sbtTransformHash"
// A hash of the parameters transformation is based on.
// If a descriptor has a different hash, we need to retransform it.
private[this] def makeCoords(mrid: ModuleRevisionId): String =
private def makeCoords(mrid: ModuleRevisionId): String =
s"${mrid.getOrganisation}:${mrid.getName}:${mrid.getRevision}"
// We now include the ModuleID in a hash, to ensure that parent-pom transformations don't corrupt child poms.
private[this] def MakeTransformHash(md: ModuleDescriptor): String = {
private def MakeTransformHash(md: ModuleDescriptor): String = {
val coords: String = makeCoords(md.getModuleRevisionId)
hash((unqualifiedKeys ++ JarPackagings ++ Set(coords)).toSeq.sorted)
}
private[this] def hash(ss: Seq[String]): String =
private def hash(ss: Seq[String]): String =
Hash.toHex(Hash(ss.flatMap(_ getBytes "UTF-8").toArray))
// Unfortunately, ModuleDescriptorParserRegistry is add-only and is a singleton instance.
@ -130,7 +130,7 @@ object CustomPomParser {
if (transformedByThisVersion(md)) md
else defaultTransformImpl(parser, md)
private[this] def transformedByThisVersion(md: ModuleDescriptor): Boolean = {
private def transformedByThisVersion(md: ModuleDescriptor): Boolean = {
val oldTransformedHashKey = "sbtTransformHash"
val extraInfo = md.getExtraInfo
val MyHash = MakeTransformHash(md)
@ -144,7 +144,7 @@ object CustomPomParser {
})
}
private[this] def defaultTransformImpl(
private def defaultTransformImpl(
parser: ModuleDescriptorParser,
md: ModuleDescriptor
): ModuleDescriptor = {
@ -182,10 +182,10 @@ object CustomPomParser {
private[sbt] def toUnqualify(propertyAttributes: Map[String, String]): Map[String, String] =
(propertyAttributes - ExtraAttributesKey) map { case (k, v) => ("e:" + k, v) }
private[this] def shouldBeUnqualified(m: Map[String, String]): Map[String, String] =
private def shouldBeUnqualified(m: Map[String, String]): Map[String, String] =
m.view.filterKeys(unqualifiedKeys).toMap
private[this] def addExtra(
private def addExtra(
properties: Map[String, String],
id: ModuleRevisionId
): ModuleRevisionId = {
@ -204,7 +204,7 @@ object CustomPomParser {
)
}
private[this] def getDependencyExtra(
private def getDependencyExtra(
m: Map[String, String]
): Map[ModuleRevisionId, Map[String, String]] =
PomExtraDependencyAttributes.getDependencyExtra(m)
@ -230,7 +230,7 @@ object CustomPomParser {
// with the extra attributes from the <properties> section
def simplify(id: ModuleRevisionId): ModuleRevisionId = PomExtraDependencyAttributes.simplify(id)
private[this] def addExtra(
private def addExtra(
dep: DependencyDescriptor,
extra: Map[ModuleRevisionId, Map[String, String]]
): DependencyDescriptor = {
@ -240,7 +240,7 @@ object CustomPomParser {
case Some(extraAttrs) => transform(dep, revId => addExtra(extraAttrs, revId))
}
}
private[this] def transform(
private def transform(
dep: DependencyDescriptor,
f: ModuleRevisionId => ModuleRevisionId
): DependencyDescriptor =
@ -250,7 +250,7 @@ object CustomPomParser {
false
)
private[this] def namespaceTransformer(
private def namespaceTransformer(
txId: ModuleRevisionId,
f: ModuleRevisionId => ModuleRevisionId
): NamespaceTransformer =
@ -261,7 +261,7 @@ object CustomPomParser {
}
// TODO: It would be better if we can make dd.isForce to `false` when VersionRange.isVersionRange is `true`.
private[this] def stripVersionRange(dd: DependencyDescriptor): DependencyDescriptor =
private def stripVersionRange(dd: DependencyDescriptor): DependencyDescriptor =
VersionRange.stripMavenVersionRange(dd.getDependencyRevisionId.getRevision) match {
case Some(newVersion) =>
val id = dd.getDependencyRevisionId

View File

@ -278,7 +278,7 @@ final class IvySbt(
def defaultConfig(log: Logger): String = withModule(log)((_, _, dc) => dc)
// these should only be referenced by withModule because lazy vals synchronize on this object
// withIvy explicitly locks the IvySbt object, so they have to be done in the right order to avoid deadlock
private[this] lazy val (moduleDescriptor0: DefaultModuleDescriptor, defaultConfig0: String) = {
private lazy val (moduleDescriptor0: DefaultModuleDescriptor, defaultConfig0: String) = {
val (baseModule, baseConfiguration) =
moduleSettings match {
case ic: InlineConfiguration => configureInline(ic, getLog(configuration.log))
@ -596,7 +596,7 @@ private[sbt] object IvySbt {
configureResolutionCache(settings, resCacheDir)
configureRepositoryCache(settings)
}
private[this] def configureResolutionCache(settings: IvySettings, resCacheDir: Option[File]) = {
private def configureResolutionCache(settings: IvySettings, resCacheDir: Option[File]) = {
val base = resCacheDir getOrElse settings.getDefaultResolutionCacheBasedir
settings.setResolutionCacheManager(new ResolutionCache(base, settings))
}
@ -622,7 +622,7 @@ private[sbt] object IvySbt {
)
}
private[this] def configureRepositoryCache(settings: IvySettings): Unit = {
private def configureRepositoryCache(settings: IvySettings): Unit = {
val cacheDir = settings.getDefaultRepositoryCacheBasedir()
val manager = new DefaultRepositoryCacheManager("default-cache", settings, cacheDir) {
override def findModuleInCache(
@ -651,7 +651,7 @@ private[sbt] object IvySbt {
}
}
}
private[this] def isProjectResolver(r: DependencyResolver): Boolean = r match {
private def isProjectResolver(r: DependencyResolver): Boolean = r match {
case _: ProjectResolver => true
case _ => false
}
@ -831,14 +831,14 @@ private[sbt] object IvySbt {
}
</ivy-module>
}
private[this] def defaultInfo(module: ModuleID): scala.xml.Elem = {
private def defaultInfo(module: ModuleID): scala.xml.Elem = {
import module._
val base = <info organisation={organization} module={name} revision={revision}/>
branchName.fold(base) { br =>
base % new scala.xml.UnprefixedAttribute("branch", br, scala.xml.Null)
}
}
private[this] def addExtraAttributes(
private def addExtraAttributes(
elem: scala.xml.Elem,
extra: Map[String, String]
): scala.xml.Elem =
@ -1040,7 +1040,7 @@ private[sbt] object IvySbt {
def copyConfigurations(artifact: Artifact, addConfiguration: ConfigRef => Unit): Unit =
copyConfigurations(artifact, addConfiguration, Vector(ConfigRef("*")))
private[this] def copyConfigurations(
private def copyConfigurations(
artifact: Artifact,
addConfiguration: ConfigRef => Unit,
allConfigurations: Vector[ConfigRef]

View File

@ -142,11 +142,11 @@ object IvyActions {
}
}
}
private[this] def withChecksums[T](resolver: DependencyResolver, checksums: Vector[String])(
private def withChecksums[T](resolver: DependencyResolver, checksums: Vector[String])(
act: => T
): T =
resolver match { case br: BasicResolver => withChecksums(br, checksums)(act); case _ => act }
private[this] def withChecksums[T](resolver: BasicResolver, checksums: Vector[String])(
private def withChecksums[T](resolver: BasicResolver, checksums: Vector[String])(
act: => T
): T = {
val previous = resolver.getChecksumAlgorithms
@ -247,7 +247,7 @@ object IvyActions {
classifiedArtifacts(id.name, classifiers filter getExcluded(id, exclude))
}
private[this] def getExcluded(id: ModuleID, exclude: Map[ModuleID, Set[String]]): Set[String] =
private def getExcluded(id: ModuleID, exclude: Map[ModuleID, Set[String]]): Set[String] =
exclude.getOrElse(restrictedCopy(id, false), Set.empty[String])
def extractExcludes(report: UpdateReport): Map[ModuleID, Set[String]] =
@ -293,7 +293,7 @@ object IvyActions {
* @param inputs The resolution inputs.
* @return The result of the resolution.
*/
private[this] def resolveAndRetrieve(
private def resolveAndRetrieve(
inputs: ResolutionInputs
): Either[ResolveException, UpdateReport] = {
// Populate resolve options from the passed arguments
@ -351,7 +351,7 @@ object IvyActions {
* @param cache The optional cache dependency.
* @return The result of the cached resolution.
*/
private[this] def cachedResolveAndRetrieve(
private def cachedResolveAndRetrieve(
inputs: ResolutionInputs,
cache: File
): Either[ResolveException, UpdateReport] = {
@ -515,7 +515,7 @@ object IvyActions {
}
}
}
private[this] def checkFilesPresent(artifacts: Seq[(IArtifact, File)]): Unit = {
private def checkFilesPresent(artifacts: Seq[(IArtifact, File)]): Unit = {
val missing = artifacts filter { case (_, file) => !file.exists }
if (missing.nonEmpty)
sys.error(

View File

@ -47,7 +47,7 @@ object IvyScalaUtil {
scalaVersion: String,
scalaVersionConfigs0: Vector[String]
) extends DependencyDescriptorMediator {
private[this] val scalaVersionConfigs = scalaVersionConfigs0.toSet
private val scalaVersionConfigs = scalaVersionConfigs0.toSet
private val binaryVersion = CrossVersion.binaryScalaVersion(scalaVersion)
def mediate(dd: DependencyDescriptor): DependencyDescriptor = {
// Mediate only for the dependencies in scalaVersion configurations. https://github.com/sbt/sbt/issues/2786

View File

@ -39,7 +39,7 @@ class ProjectResolver(name: String, map: Map[ModuleRevisionId, ModuleDescriptor]
def getDependency(dd: DependencyDescriptor, data: ResolveData): ResolvedModuleRevision =
getDependency(dd.getDependencyRevisionId).orNull
private[this] def getDependency(revisionId: ModuleRevisionId): Option[ResolvedModuleRevision] = {
private def getDependency(revisionId: ModuleRevisionId): Option[ResolvedModuleRevision] = {
def constructResult(descriptor: ModuleDescriptor) =
new ResolvedModuleRevision(this, this, descriptor, report(revisionId), true)
map get revisionId map constructResult
@ -93,7 +93,7 @@ class ProjectResolver(name: String, map: Map[ModuleRevisionId, ModuleDescriptor]
def getNamespace = Namespace.SYSTEM_NAMESPACE
private[this] var settings: Option[ResolverSettings] = None
private var settings: Option[ResolverSettings] = None
def dumpSettings(): Unit = ()
def setSettings(settings: ResolverSettings): Unit = { this.settings = Some(settings) }

View File

@ -21,7 +21,7 @@ import sbt.librarymanagement._
*/
private[sbt] final class ResolutionCache(base: File, settings: IvySettings)
extends ResolutionCacheManager {
private[this] def resolvedFileInCache(m: ModuleRevisionId, name: String, ext: String): File = {
private def resolvedFileInCache(m: ModuleRevisionId, name: String, ext: String): File = {
val p = ResolvedPattern
val f = IvyPatternHelper.substitute(
p,
@ -39,7 +39,7 @@ private[sbt] final class ResolutionCache(base: File, settings: IvySettings)
)
new File(base, f)
}
private[this] val reportBase: File = new File(base, ReportDirectory)
private val reportBase: File = new File(base, ReportDirectory)
def getResolutionCacheRoot: File = base
def clean(): Unit = IO.delete(base)

View File

@ -19,7 +19,7 @@ object ErrorMessageAuthenticator {
else getTheAuthenticator
}
private[this] def getTheAuthenticator: Option[Authenticator] = {
private def getTheAuthenticator: Option[Authenticator] = {
withJavaReflectErrorHandling {
val field = classOf[Authenticator].getDeclaredField("theAuthenticator")
field.setAccessible(true)
@ -27,13 +27,13 @@ object ErrorMessageAuthenticator {
}
}
private[this] def getDefaultAuthenticator: Option[Authenticator] =
private def getDefaultAuthenticator: Option[Authenticator] =
withJavaReflectErrorHandling {
val method = classOf[Authenticator].getDeclaredMethod("getDefault")
Option(method.invoke(null).asInstanceOf[Authenticator])
}
private[this] def withJavaReflectErrorHandling[A](t: => Option[A]): Option[A] = {
private def withJavaReflectErrorHandling[A](t: => Option[A]): Option[A] = {
try t
catch {
case e: ReflectiveOperationException => handleReflectionException(e)
@ -46,7 +46,7 @@ object ErrorMessageAuthenticator {
}
}
private[this] def handleReflectionException(t: Throwable) = {
private def handleReflectionException(t: Throwable) = {
Message.debug("Error occurred while getting the original authenticator: " + t.getMessage)
None
}

View File

@ -89,7 +89,7 @@ private[sbt] final case class MergedDescriptors(a: DependencyDescriptor, b: Depe
def getIncludeRules(moduleConfigurations: Array[String]) =
concat(a.getIncludeRules(moduleConfigurations), b.getIncludeRules(moduleConfigurations))
private[this] def concatArtifacts(
private def concatArtifacts(
a: DependencyDescriptor,
as: Array[DependencyArtifactDescriptor],
b: DependencyDescriptor,
@ -101,14 +101,14 @@ private[sbt] final case class MergedDescriptors(a: DependencyDescriptor, b: Depe
else if (bs.isEmpty) explicitConfigurations(a, as) ++ defaultArtifact(b)
else concat(explicitConfigurations(a, as), explicitConfigurations(b, bs))
}
private[this] def explicitConfigurations(
private def explicitConfigurations(
base: DependencyDescriptor,
arts: Array[DependencyArtifactDescriptor]
): Array[DependencyArtifactDescriptor] =
arts map { art =>
explicitConfigurations(base, art)
}
private[this] def explicitConfigurations(
private def explicitConfigurations(
base: DependencyDescriptor,
art: DependencyArtifactDescriptor
): DependencyArtifactDescriptor = {
@ -122,7 +122,7 @@ private[sbt] final case class MergedDescriptors(a: DependencyDescriptor, b: Depe
case _ => art
}
}
private[this] def defaultArtifact(
private def defaultArtifact(
a: DependencyDescriptor
): Array[DependencyArtifactDescriptor] = {
val dd = new DefaultDependencyArtifactDescriptor(
@ -139,7 +139,7 @@ private[sbt] final case class MergedDescriptors(a: DependencyDescriptor, b: Depe
if (a.getAllDependencyArtifacts.isEmpty) Array(dd)
else a.getAllDependencyArtifacts filter (_ == dd)
}
private[this] def copyWithConfigurations(
private def copyWithConfigurations(
dd: DependencyArtifactDescriptor,
confs: Seq[String]
): DependencyArtifactDescriptor = {
@ -155,13 +155,13 @@ private[sbt] final case class MergedDescriptors(a: DependencyDescriptor, b: Depe
addConfigurations(newd, confs)
newd
}
private[this] def addConfigurations(
private def addConfigurations(
dd: DefaultDependencyArtifactDescriptor,
confs: Seq[String]
): Unit =
confs foreach dd.addConfiguration
private[this] def concat[T: reflect.ClassTag](a: Array[T], b: Array[T]): Array[T] =
private def concat[T: reflect.ClassTag](a: Array[T], b: Array[T]): Array[T] =
(a ++ b).distinct
def getAllExcludeRules = concat(a.getAllExcludeRules, b.getAllExcludeRules)

View File

@ -368,7 +368,7 @@ private[sbt] case class SbtChainResolver(
/* Ivy keeps module descriptors in memory, so we need to make sure that the
* resolved module revision is in fact the one found in the latest resolver. */
private[this] def reparseModuleDescriptor(
private def reparseModuleDescriptor(
dd: DependencyDescriptor,
data: ResolveData,
resolver: DependencyResolver,
@ -407,7 +407,7 @@ private[sbt] case class SbtChainResolver(
}
/** Ported from BasicResolver#findFirstAirfactRef. */
private[this] def findFirstArtifactRef(
private def findFirstArtifactRef(
md: ModuleDescriptor,
data: ResolveData,
resolver: DependencyResolver
@ -443,7 +443,7 @@ private[sbt] case class SbtChainResolver(
}
/** Ported from ChainResolver#forcedRevision. */
private[this] def forcedRevision(rmr: ResolvedModuleRevision): ResolvedModuleRevision =
private def forcedRevision(rmr: ResolvedModuleRevision): ResolvedModuleRevision =
new ResolvedModuleRevision(
rmr.getResolver,
rmr.getArtifactResolver,
@ -453,7 +453,7 @@ private[sbt] case class SbtChainResolver(
)
/** Ported from ChainResolver#resolvedRevision. */
private[this] def resolvedRevision(rmr: ResolvedModuleRevision): ResolvedModuleRevision =
private def resolvedRevision(rmr: ResolvedModuleRevision): ResolvedModuleRevision =
if (isDual)
new ResolvedModuleRevision(
rmr.getResolver,
@ -465,7 +465,7 @@ private[sbt] case class SbtChainResolver(
else rmr
/** Ported from ChainResolver#setLatestIfRequired. */
private[this] def setLatestIfRequired(
private def setLatestIfRequired(
resolver: DependencyResolver,
latest: Option[LatestStrategy]
): Option[LatestStrategy] =
@ -478,21 +478,21 @@ private[sbt] case class SbtChainResolver(
}
/** Ported from ChainResolver#getLatestStrategyName. */
private[this] def latestStrategyName(resolver: DependencyResolver): Option[String] =
private def latestStrategyName(resolver: DependencyResolver): Option[String] =
resolver match {
case r: HasLatestStrategy => Some(r.getLatest)
case _ => None
}
/** Ported from ChainResolver#getLatest. */
private[this] def latestStrategy(resolver: DependencyResolver): Option[LatestStrategy] =
private def latestStrategy(resolver: DependencyResolver): Option[LatestStrategy] =
resolver match {
case r: HasLatestStrategy => Some(r.getLatestStrategy)
case _ => None
}
/** Ported from ChainResolver#setLatest. */
private[this] def doSetLatestStrategy(
private def doSetLatestStrategy(
resolver: DependencyResolver,
latest: Option[LatestStrategy]
): Option[LatestStrategy] =

View File

@ -103,7 +103,7 @@ object PomExtraDependencyAttributes {
LinesP.split(s).map(_.trim).filter(!_.isEmpty).map(ModuleRevisionId.decode)
)
private[this] val LinesP = Pattern.compile("(?m)^")
private val LinesP = Pattern.compile("(?m)^")
/**
* Creates the "extra" property values for DependencyDescriptors that can be written into a maven pom

View File

@ -62,13 +62,13 @@ object Credentials {
case d: DirectCredentials => add(d.realm, d.host, d.userName, d.passwd)
}
private[this] val RealmKeys = List("realm")
private[this] val HostKeys = List("host", "hostname")
private[this] val UserKeys = List("user", "user.name", "username")
private[this] val PasswordKeys = List("password", "pwd", "pass", "passwd")
private val RealmKeys = List("realm")
private val HostKeys = List("host", "hostname")
private val UserKeys = List("user", "user.name", "username")
private val PasswordKeys = List("password", "pwd", "pass", "passwd")
import scala.jdk.CollectionConverters._
private[this] def read(from: File): Map[String, String] = {
private def read(from: File): Map[String, String] = {
val properties = new java.util.Properties
IO.load(properties, from)
properties.asScala.map { case (k, v) => (k.toString, v.toString.trim) }.toMap