Merge pull request #453 from jtjeferreira/fix-warnings

[2.x] fix more warnings
This commit is contained in:
eugene yokota 2024-10-07 19:53:48 -04:00 committed by GitHub
commit 0fdf4ae053
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 137 additions and 127 deletions

View File

@ -18,37 +18,37 @@ final class SemComparator private (
this.withOp(sbt.internal.librarymanagement.SemSelOperator.Lte) this.withOp(sbt.internal.librarymanagement.SemSelOperator.Lte)
) )
} else { Seq(this) } } else { Seq(this) }
} }
override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match { override def equals(o: Any): Boolean = this.eq(o.asInstanceOf[AnyRef]) || (o match {
case x: SemComparator => (this.op == x.op) && (this.major == x.major) && (this.minor == x.minor) && (this.patch == x.patch) && (this.tags == x.tags) case x: SemComparator => (this.op == x.op) && (this.major == x.major) && (this.minor == x.minor) && (this.patch == x.patch) && (this.tags == x.tags)
case _ => false case _ => false
}) })
override def hashCode: Int = { override def hashCode: Int = {
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.librarymanagement.SemComparator".##) + op.##) + major.##) + minor.##) + patch.##) + tags.##) 37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.librarymanagement.SemComparator".##) + op.##) + major.##) + minor.##) + patch.##) + tags.##)
} }
override def toString: String = { override def toString: String = {
this.toStringImpl this.toStringImpl
} }
private[this] def copy(op: sbt.internal.librarymanagement.SemSelOperator = op, major: Option[Long] = major, minor: Option[Long] = minor, patch: Option[Long] = patch, tags: Seq[String] = tags): SemComparator = { private[this] def copy(op: sbt.internal.librarymanagement.SemSelOperator = op, major: Option[Long] = major, minor: Option[Long] = minor, patch: Option[Long] = patch, tags: Seq[String] = tags): SemComparator = {
new SemComparator(op, major, minor, patch, tags) new SemComparator(op, major, minor, patch, tags)
} }
def withOp(op: sbt.internal.librarymanagement.SemSelOperator): SemComparator = { def withOp(op: sbt.internal.librarymanagement.SemSelOperator): SemComparator = {
copy(op = op) copy(op = op)
} }
def withMajor(major: Option[Long]): SemComparator = { def withMajor(major: Option[Long]): SemComparator = {
copy(major = major) copy(major = major)
} }
def withMinor(minor: Option[Long]): SemComparator = { def withMinor(minor: Option[Long]): SemComparator = {
copy(minor = minor) copy(minor = minor)
} }
def withPatch(patch: Option[Long]): SemComparator = { def withPatch(patch: Option[Long]): SemComparator = {
copy(patch = patch) copy(patch = patch)
} }
def withTags(tags: Seq[String]): SemComparator = { def withTags(tags: Seq[String]): SemComparator = {
copy(tags = tags) copy(tags = tags)
} }
} }
object SemComparator extends sbt.internal.librarymanagement.SemComparatorFunctions { object SemComparator extends sbt.internal.librarymanagement.SemComparatorFunctions {
def apply(comparator: String): SemComparator = parse(comparator) def apply(comparator: String): SemComparator = parse(comparator)

View File

@ -84,7 +84,7 @@ object SemanticSelector {
def apply(selector: String): SemanticSelector = { def apply(selector: String): SemanticSelector = {
val orChunkTokens = selector.split("\\s+\\|\\|\\s+").map(_.trim) val orChunkTokens = selector.split("\\s+\\|\\|\\s+").map(_.trim)
val orChunks = orChunkTokens.map { chunk => sbt.internal.librarymanagement.SemSelAndChunk(chunk) } val orChunks = orChunkTokens.map { chunk => sbt.internal.librarymanagement.SemSelAndChunk(chunk) }
SemanticSelector(orChunks) SemanticSelector(scala.collection.immutable.ArraySeq.unsafeWrapArray(orChunks))
} }
def apply(selectors: Seq[sbt.internal.librarymanagement.SemSelAndChunk]): SemanticSelector = new SemanticSelector(selectors) def apply(selectors: Seq[sbt.internal.librarymanagement.SemSelAndChunk]): SemanticSelector = new SemanticSelector(selectors)
} }

View File

@ -87,7 +87,7 @@
"def apply(selector: String): SemanticSelector = {", "def apply(selector: String): SemanticSelector = {",
" val orChunkTokens = selector.split(\"\\\\s+\\\\|\\\\|\\\\s+\").map(_.trim)", " val orChunkTokens = selector.split(\"\\\\s+\\\\|\\\\|\\\\s+\").map(_.trim)",
" val orChunks = orChunkTokens.map { chunk => sbt.internal.librarymanagement.SemSelAndChunk(chunk) }", " val orChunks = orChunkTokens.map { chunk => sbt.internal.librarymanagement.SemSelAndChunk(chunk) }",
" SemanticSelector(orChunks)", " SemanticSelector(scala.collection.immutable.ArraySeq.unsafeWrapArray(orChunks))",
"}" "}"
] ]
}, },

View File

@ -8,7 +8,8 @@ import java.util.Locale
private[librarymanagement] abstract class SemSelAndChunkFunctions { private[librarymanagement] abstract class SemSelAndChunkFunctions {
protected def parse(andClauseToken: String): SemSelAndChunk = { protected def parse(andClauseToken: String): SemSelAndChunk = {
val comparatorTokens = andClauseToken.split("\\s+") val comparatorTokens =
scala.collection.immutable.ArraySeq.unsafeWrapArray(andClauseToken.split("\\s+"))
val hyphenIndex = comparatorTokens.indexWhere(_ == "-") val hyphenIndex = comparatorTokens.indexWhere(_ == "-")
val comparators = if (hyphenIndex == -1) { val comparators = if (hyphenIndex == -1) {
comparatorTokens.map(SemComparator.apply) comparatorTokens.map(SemComparator.apply)

View File

@ -15,7 +15,7 @@ trait GlobalLockFormat { self: BasicJsonProtocol =>
implicit lazy val globalLockIsoString: IsoString[GlobalLock] = implicit lazy val globalLockIsoString: IsoString[GlobalLock] =
IsoString.iso(_ => "<lock>", _ => NoGlobalLock) IsoString.iso(_ => "<lock>", _ => NoGlobalLock)
implicit lazy val GlobalLockFormat: JsonFormat[GlobalLock] = implicitly implicit lazy val GlobalLockFormat: JsonFormat[GlobalLock] = isoStringFormat(globalLockIsoString)
} }
private[sbt] object GlobalLockFormats { private[sbt] object GlobalLockFormats {

View File

@ -12,5 +12,5 @@ trait LoggerFormat { self: BasicJsonProtocol =>
implicit lazy val xsbtiLoggerIsoString: IsoString[Logger] = implicit lazy val xsbtiLoggerIsoString: IsoString[Logger] =
IsoString.iso(_ => "<logger>", _ => Null) IsoString.iso(_ => "<logger>", _ => Null)
implicit lazy val LoggerFormat: JsonFormat[Logger] = implicitly implicit lazy val LoggerFormat: JsonFormat[Logger] = isoStringFormat(implicitly)
} }

View File

@ -36,7 +36,7 @@ trait ExternalIvyConfigurationFormats { self: sbt.internal.librarymanagement.for
with sbt.librarymanagement.SftpRepositoryFormats with sbt.librarymanagement.SftpRepositoryFormats
with sbt.librarymanagement.PasswordAuthenticationFormats with sbt.librarymanagement.PasswordAuthenticationFormats
with sbt.librarymanagement.KeyFileAuthenticationFormats => with sbt.librarymanagement.KeyFileAuthenticationFormats =>
implicit lazy val ExternalIvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.ExternalIvyConfiguration] = new JsonFormat[sbt.librarymanagement.ivy.ExternalIvyConfiguration] { implicit lazy val ExternalIvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.ExternalIvyConfiguration] = new JsonFormat[sbt.librarymanagement.ivy.ExternalIvyConfiguration] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ivy.ExternalIvyConfiguration = { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ivy.ExternalIvyConfiguration = {
__jsOpt match { __jsOpt match {
case Some(__js) => case Some(__js) =>
@ -63,5 +63,5 @@ implicit lazy val ExternalIvyConfigurationFormat: JsonFormat[sbt.librarymanageme
builder.addField("extraResolvers", obj.extraResolvers) builder.addField("extraResolvers", obj.extraResolvers)
builder.endObject() builder.endObject()
} }
} }
} }

View File

@ -38,7 +38,7 @@ trait InlineIvyConfigurationFormats { self: sbt.internal.librarymanagement.forma
with sbt.librarymanagement.SftpRepositoryFormats with sbt.librarymanagement.SftpRepositoryFormats
with sbt.librarymanagement.PasswordAuthenticationFormats with sbt.librarymanagement.PasswordAuthenticationFormats
with sbt.librarymanagement.KeyFileAuthenticationFormats => with sbt.librarymanagement.KeyFileAuthenticationFormats =>
implicit lazy val InlineIvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.InlineIvyConfiguration] = new JsonFormat[sbt.librarymanagement.ivy.InlineIvyConfiguration] { implicit lazy val InlineIvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.InlineIvyConfiguration] = new JsonFormat[sbt.librarymanagement.ivy.InlineIvyConfiguration] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ivy.InlineIvyConfiguration = { override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.librarymanagement.ivy.InlineIvyConfiguration = {
__jsOpt match { __jsOpt match {
case Some(__js) => case Some(__js) =>
@ -73,5 +73,5 @@ implicit lazy val InlineIvyConfigurationFormat: JsonFormat[sbt.librarymanagement
builder.addField("resolutionCacheDir", obj.resolutionCacheDir) builder.addField("resolutionCacheDir", obj.resolutionCacheDir)
builder.endObject() builder.endObject()
} }
} }
} }

View File

@ -41,5 +41,5 @@ trait IvyConfigurationFormats { self: sbt.internal.librarymanagement.formats.Glo
with sbt.librarymanagement.SftpRepositoryFormats with sbt.librarymanagement.SftpRepositoryFormats
with sbt.librarymanagement.PasswordAuthenticationFormats with sbt.librarymanagement.PasswordAuthenticationFormats
with sbt.librarymanagement.KeyFileAuthenticationFormats => with sbt.librarymanagement.KeyFileAuthenticationFormats =>
implicit lazy val IvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.IvyConfiguration] = flatUnionFormat2[sbt.librarymanagement.ivy.IvyConfiguration, sbt.librarymanagement.ivy.InlineIvyConfiguration, sbt.librarymanagement.ivy.ExternalIvyConfiguration]("type") implicit lazy val IvyConfigurationFormat: JsonFormat[sbt.librarymanagement.ivy.IvyConfiguration] = flatUnionFormat2[sbt.librarymanagement.ivy.IvyConfiguration, sbt.librarymanagement.ivy.InlineIvyConfiguration, sbt.librarymanagement.ivy.ExternalIvyConfiguration]("type")
} }

View File

@ -50,16 +50,11 @@ private[sbt] object ConvertResolver {
* checksum-friendly URL publishing shim. * checksum-friendly URL publishing shim.
*/ */
private object ChecksumFriendlyURLResolver { private object ChecksumFriendlyURLResolver {
// TODO - When we dump JDK6 support we can remove this hackery import java.lang.reflect.AccessibleObject
// import java.lang.reflect.AccessibleObject
type AccessibleObject = {
def setAccessible(value: Boolean): Unit
}
private def reflectiveLookup[A <: AccessibleObject](f: Class[_] => A): Option[A] = private def reflectiveLookup[A <: AccessibleObject](f: Class[_] => A): Option[A] =
try { try {
val cls = classOf[RepositoryResolver] val cls = classOf[RepositoryResolver]
val thing = f(cls) val thing = f(cls)
import scala.language.reflectiveCalls
thing.setAccessible(true) thing.setAccessible(true)
Some(thing) Some(thing)
} catch { } catch {

View File

@ -29,6 +29,7 @@ import sbt.internal.librarymanagement.mavenint.{
SbtPomExtraProperties SbtPomExtraProperties
} }
import sbt.io.Hash import sbt.io.Hash
import scala.collection.immutable.ArraySeq
// @deprecated("We now use an Aether-based pom parser.", "0.13.8") // @deprecated("We now use an Aether-based pom parser.", "0.13.8")
final class CustomPomParser( final class CustomPomParser(
@ -311,7 +312,7 @@ object CustomPomParser {
) dmd.addExtraAttributeNamespace(key, value) ) dmd.addExtraAttributeNamespace(key, value)
IvySbt.addExtraNamespace(dmd) IvySbt.addExtraNamespace(dmd)
val withExtra = md.getDependencies map { dd => val withExtra = ArraySeq.unsafeWrapArray(md.getDependencies) map { dd =>
addExtra(dd, dependencyExtra) addExtra(dd, dependencyExtra)
} }
val withVersionRangeMod: Seq[DependencyDescriptor] = val withVersionRangeMod: Seq[DependencyDescriptor] =

View File

@ -36,6 +36,7 @@ import org.apache.ivy.util.extendable.ExtendableItem
import org.apache.ivy.util.url._ import org.apache.ivy.util.url._
import scala.xml.NodeSeq import scala.xml.NodeSeq
import scala.collection.mutable import scala.collection.mutable
import scala.collection.immutable.ArraySeq
import scala.util.{ Success, Failure } import scala.util.{ Success, Failure }
import sbt.util._ import sbt.util._
import sbt.librarymanagement.{ ModuleDescriptorConfiguration => InlineConfiguration, _ } import sbt.librarymanagement.{ ModuleDescriptorConfiguration => InlineConfiguration, _ }
@ -891,7 +892,7 @@ private[sbt] object IvySbt {
def inconsistentDuplicateWarning(moduleID: DefaultModuleDescriptor): List[String] = { def inconsistentDuplicateWarning(moduleID: DefaultModuleDescriptor): List[String] = {
import IvyRetrieve.toModuleID import IvyRetrieve.toModuleID
val dds = moduleID.getDependencies val dds = ArraySeq.unsafeWrapArray(moduleID.getDependencies)
val deps = dds flatMap { dd => val deps = dds flatMap { dd =>
val module = toModuleID(dd.getDependencyRevisionId) val module = toModuleID(dd.getDependencyRevisionId)
dd.getModuleConfigurations map (c => module.withConfigurations(Some(c))) dd.getModuleConfigurations map (c => module.withConfigurations(Some(c)))

View File

@ -320,8 +320,9 @@ object IvyActions {
val resolveReport = ivyInstance.resolve(moduleDescriptor, resolveOptions) val resolveReport = ivyInstance.resolve(moduleDescriptor, resolveOptions)
if (resolveReport.hasError && !missingOk) { if (resolveReport.hasError && !missingOk) {
import scala.jdk.CollectionConverters._
// If strict error, collect report information and generated UnresolvedWarning // If strict error, collect report information and generated UnresolvedWarning
val messages = resolveReport.getAllProblemMessages.toArray.map(_.toString).distinct val messages = resolveReport.getAllProblemMessages.asScala.toSeq.map(_.toString).distinct
val failedPaths = resolveReport.getUnresolvedDependencies.map { node => val failedPaths = resolveReport.getUnresolvedDependencies.map { node =>
val moduleID = IvyRetrieve.toModuleID(node.getId) val moduleID = IvyRetrieve.toModuleID(node.getId)
val path = IvyRetrieve val path = IvyRetrieve

View File

@ -6,6 +6,7 @@ package sbt.internal.librarymanagement
import java.io.File import java.io.File
import java.{ util => ju } import java.{ util => ju }
import collection.mutable import collection.mutable
import collection.immutable.ArraySeq
import org.apache.ivy.core.{ module, report, resolve } import org.apache.ivy.core.{ module, report, resolve }
import module.descriptor.{ Artifact => IvyArtifact, License => IvyLicense } import module.descriptor.{ Artifact => IvyArtifact, License => IvyLicense }
import module.id.{ ModuleRevisionId, ModuleId => IvyModuleId } import module.id.{ ModuleRevisionId, ModuleId => IvyModuleId }
@ -187,7 +188,9 @@ object IvyRetrieve {
case _ => Vector.empty case _ => Vector.empty
} }
val callers = dep.getCallers(confReport.getConfiguration).toVector map { toCaller } val callers = dep.getCallers(confReport.getConfiguration).toVector map { toCaller }
val (resolved, missing) = artifacts(confReport getDownloadReports revId) val (resolved, missing) = artifacts(
ArraySeq.unsafeWrapArray(confReport.getDownloadReports(revId))
)
ModuleReport( ModuleReport(
moduleId, moduleId,
@ -212,7 +215,7 @@ object IvyRetrieve {
} }
def evicted(confReport: ConfigurationResolveReport): Seq[ModuleID] = def evicted(confReport: ConfigurationResolveReport): Seq[ModuleID] =
confReport.getEvictedNodes.map(node => toModuleID(node.getId)) ArraySeq.unsafeWrapArray(confReport.getEvictedNodes).map(node => toModuleID(node.getId))
def toModuleID(revID: ModuleRevisionId): ModuleID = def toModuleID(revID: ModuleRevisionId): ModuleID =
ModuleID(revID.getOrganisation, revID.getName, revID.getRevision) ModuleID(revID.getOrganisation, revID.getName, revID.getRevision)

View File

@ -13,6 +13,7 @@ import sbt.librarymanagement._
import Resolver._ import Resolver._
import mavenint.PomExtraDependencyAttributes import mavenint.PomExtraDependencyAttributes
import scala.collection.immutable.ArraySeq
// Node needs to be renamed to XNode because the task subproject contains a Node type that will shadow // Node needs to be renamed to XNode because the task subproject contains a Node type that will shadow
// scala.xml.Node when generating aggregated API documentation // scala.xml.Node when generating aggregated API documentation
import scala.xml.{ Elem, Node => XNode, NodeSeq, PrettyPrinter, PrefixedAttribute } import scala.xml.{ Elem, Node => XNode, NodeSeq, PrettyPrinter, PrefixedAttribute }
@ -147,7 +148,7 @@ class MakePom(val log: Logger) {
{ {
val deps = depsInConfs(module, configurations) val deps = depsInConfs(module, configurations)
makeProperties(module, deps) ++ makeProperties(module, deps) ++
makeDependencies(deps, includeTypes, module.getAllExcludeRules) makeDependencies(deps, includeTypes, ArraySeq.unsafeWrapArray(module.getAllExcludeRules))
} }
{makeRepositories(ivy.getSettings, allRepositories, filterRepositories)} {makeRepositories(ivy.getSettings, allRepositories, filterRepositories)}
</project>) </project>)
@ -442,7 +443,9 @@ class MakePom(val log: Logger) {
def exclusions(dependency: DependencyDescriptor): NodeSeq = exclusions(dependency, Nil) def exclusions(dependency: DependencyDescriptor): NodeSeq = exclusions(dependency, Nil)
def exclusions(dependency: DependencyDescriptor, excludes: Seq[ExcludeRule]): NodeSeq = { def exclusions(dependency: DependencyDescriptor, excludes: Seq[ExcludeRule]): NodeSeq = {
val excl = dependency.getExcludeRules(dependency.getModuleConfigurations) ++ excludes val excl = ArraySeq.unsafeWrapArray(
dependency.getExcludeRules(dependency.getModuleConfigurations)
) ++ excludes
val (warns, excls) = IvyUtil.separate(excl.map(makeExclusion)) val (warns, excls) = IvyUtil.separate(excl.map(makeExclusion))
if (warns.nonEmpty) log.warn(warns.mkString(IO.Newline)) if (warns.nonEmpty) log.warn(warns.mkString(IO.Newline))
if (excls.nonEmpty) <exclusions>{ if (excls.nonEmpty) <exclusions>{
@ -500,8 +503,10 @@ class MakePom(val log: Logger) {
r match { case c: ChainResolver => flatten(castResolvers(c.getResolvers)); case _ => r :: Nil } r match { case c: ChainResolver => flatten(castResolvers(c.getResolvers)); case _ => r :: Nil }
// cast the contents of a pre-generics collection // cast the contents of a pre-generics collection
private def castResolvers(s: java.util.Collection[_]): Seq[DependencyResolver] = private def castResolvers(s: java.util.Collection[_]): Seq[DependencyResolver] = {
s.toArray.map(_.asInstanceOf[DependencyResolver]) import scala.jdk.CollectionConverters._
s.asScala.toSeq.map(_.asInstanceOf[DependencyResolver])
}
def toID(name: String) = checkID(name.filter(isValidIDCharacter).mkString, name) def toID(name: String) = checkID(name.filter(isValidIDCharacter).mkString, name)
def isValidIDCharacter(c: Char) = !"""\/:"<>|?*""".contains(c) def isValidIDCharacter(c: Char) = !"""\/:"<>|?*""".contains(c)
@ -535,6 +540,6 @@ class MakePom(val log: Logger) {
else // TODO: translate the dependency to contain only configurations to keep else // TODO: translate the dependency to contain only configurations to keep
Some(dependency) Some(dependency)
} }
module.getDependencies flatMap translate ArraySeq.unsafeWrapArray(module.getDependencies) flatMap translate
} }
} }

View File

@ -159,8 +159,7 @@ private[sbt] class CachedResolutionResolveCache {
} }
def extractOverrides(md0: ModuleDescriptor): Vector[IvyOverride] = { def extractOverrides(md0: ModuleDescriptor): Vector[IvyOverride] = {
import scala.jdk.CollectionConverters._ import scala.jdk.CollectionConverters._
md0.getAllDependencyDescriptorMediators.getAllRules.asScala.toSeq.toVector sortBy { md0.getAllDependencyDescriptorMediators.getAllRules.asScala.toVector sortBy { case (k, _) =>
case (k, _) =>
k.toString k.toString
} collect { case (k: MapMatcher, v: OverrideDependencyDescriptorMediator) => } collect { case (k: MapMatcher, v: OverrideDependencyDescriptorMediator) =>
val attr: Map[Any, Any] = k.getAttributes.asScala.toMap val attr: Map[Any, Any] = k.getAttributes.asScala.toMap
@ -398,13 +397,14 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
doWorkUsingIvy(md) doWorkUsingIvy(md)
} }
def doWorkUsingIvy(md: ModuleDescriptor): Either[ResolveException, UpdateReport] = { def doWorkUsingIvy(md: ModuleDescriptor): Either[ResolveException, UpdateReport] = {
import scala.jdk.CollectionConverters._
val options1 = new ResolveOptions(options0) val options1 = new ResolveOptions(options0)
val rr = withIvy(log) { ivy => val rr = withIvy(log) { ivy =>
ivy.resolve(md, options1) ivy.resolve(md, options1)
} }
if (!rr.hasError || missingOk) Right(IvyRetrieve.updateReport(rr, cachedDescriptor)) if (!rr.hasError || missingOk) Right(IvyRetrieve.updateReport(rr, cachedDescriptor))
else { else {
val messages = rr.getAllProblemMessages.toArray.map(_.toString).distinct val messages = rr.getAllProblemMessages.asScala.toSeq.map(_.toString).distinct
val failedPaths = ListMap(rr.getUnresolvedDependencies map { node => val failedPaths = ListMap(rr.getUnresolvedDependencies map { node =>
val m = IvyRetrieve.toModuleID(node.getId) val m = IvyRetrieve.toModuleID(node.getId)
val path = IvyRetrieve.findPath(node, md.getModuleRevisionId) map { x => val path = IvyRetrieve.findPath(node, md.getModuleRevisionId) map { x =>
@ -781,7 +781,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
} }
val merged = (modules groupBy { m => val merged = (modules groupBy { m =>
(m.module.organization, m.module.name, m.module.revision) (m.module.organization, m.module.name, m.module.revision)
}).toSeq.toVector flatMap { case (_, xs) => }).toVector flatMap { case (_, xs) =>
if (xs.size < 2) xs if (xs.size < 2) xs
else Vector(mergeModuleReports(xs)) else Vector(mergeModuleReports(xs))
} }
@ -937,7 +937,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
}).mkString("(", ", ", ")") }).mkString("(", ", ", ")")
) )
} }
case None => case _ =>
getSettings.getConflictManager(IvyModuleId.newInstance(organization, name)) match { getSettings.getConflictManager(IvyModuleId.newInstance(organization, name)) match {
case ncm: NoConflictManager => (conflicts, Vector(), ncm.toString) case ncm: NoConflictManager => (conflicts, Vector(), ncm.toString)
case _: StrictConflictManager => case _: StrictConflictManager =>

View File

@ -1,6 +1,7 @@
package sbt.internal.librarymanagement package sbt.internal.librarymanagement
package ivyint package ivyint
import scala.collection.immutable.ArraySeq
import org.apache.ivy.core import org.apache.ivy.core
import core.module.descriptor.{ DependencyArtifactDescriptor, DefaultDependencyArtifactDescriptor } import core.module.descriptor.{ DependencyArtifactDescriptor, DefaultDependencyArtifactDescriptor }
import core.module.descriptor.DependencyDescriptor import core.module.descriptor.DependencyDescriptor
@ -117,7 +118,7 @@ private[sbt] final case class MergedDescriptors(a: DependencyDescriptor, b: Depe
// See gh-1500, gh-2002 // See gh-1500, gh-2002
aConfs match { aConfs match {
case None | Some(Nil) | Some(List("*")) => case None | Some(Nil) | Some(List("*")) =>
copyWithConfigurations(art, base.getModuleConfigurations) copyWithConfigurations(art, ArraySeq.unsafeWrapArray(base.getModuleConfigurations))
case _ => art case _ => art
} }
} }
@ -132,7 +133,7 @@ private[sbt] final case class MergedDescriptors(a: DependencyDescriptor, b: Depe
null, null,
null null
) )
addConfigurations(dd, a.getModuleConfigurations) addConfigurations(dd, ArraySeq.unsafeWrapArray(a.getModuleConfigurations))
// If the dependency descriptor is empty, then it means that it has been created from a POM file. In this case, // If the dependency descriptor is empty, then it means that it has been created from a POM file. In this case,
// it is correct to create a seemingly non-existent dependency artifact. // it is correct to create a seemingly non-existent dependency artifact.
if (a.getAllDependencyArtifacts.isEmpty) Array(dd) if (a.getAllDependencyArtifacts.isEmpty) Array(dd)

View File

@ -1,6 +1,7 @@
package sbt.internal.librarymanagement package sbt.internal.librarymanagement
package mavenint package mavenint
import scala.collection.immutable.ArraySeq
import java.util.Properties import java.util.Properties
import java.util.regex.Pattern import java.util.regex.Pattern
@ -100,8 +101,9 @@ object PomExtraDependencyAttributes {
} }
/** parses the sequence of dependencies with extra attribute information, with one dependency per line */ /** parses the sequence of dependencies with extra attribute information, with one dependency per line */
def readDependencyExtra(s: String): Seq[ModuleRevisionId] = def readDependencyExtra(s: String): Seq[ModuleRevisionId] = ArraySeq.unsafeWrapArray(
LinesP.split(s).map(_.trim).filter(!_.isEmpty).map(ModuleRevisionId.decode) LinesP.split(s).map(_.trim).filter(!_.isEmpty).map(ModuleRevisionId.decode)
)
private[this] val LinesP = Pattern.compile("(?m)^") private[this] val LinesP = Pattern.compile("(?m)^")