diff --git a/internal/compiler-bridge-test/src/test/scala/sbt/internal/inc/CompilingSpecification.scala b/internal/compiler-bridge-test/src/test/scala/sbt/internal/inc/CompilingSpecification.scala index 519499e28..2b48f1781 100644 --- a/internal/compiler-bridge-test/src/test/scala/sbt/internal/inc/CompilingSpecification.scala +++ b/internal/compiler-bridge-test/src/test/scala/sbt/internal/inc/CompilingSpecification.scala @@ -281,8 +281,8 @@ trait CompilingSpecification extends AbstractBridgeProviderTestkit { val cp = (si.allJars).map(_.toPath) ++ Array(targetDir) val classpath = cp.map(converter.toVirtualFile) sc.doc( - sources = sources.toArray[VirtualFile], - classpath = classpath, + sources = sources.toIndexedSeq, + classpath = classpath.toIndexedSeq, converter = converter, outputDirectory = targetDir, options = Nil, @@ -305,7 +305,7 @@ trait CompilingSpecification extends AbstractBridgeProviderTestkit { val cp = (si.allJars).map(_.toPath) ++ Array(targetDir) val classpath = cp.map(converter.toVirtualFile) sc.console( - classpath = classpath, + classpath = classpath.toIndexedSeq, converter = converter, options = Nil, initialCommands = initial, @@ -327,7 +327,7 @@ trait CompilingSpecification extends AbstractBridgeProviderTestkit { val cp = (si.allJars).map(_.toPath) ++ Array(targetDir) val classpath = cp.map(converter.toVirtualFile) sc.interactiveConsole( - classpath = classpath, + classpath = classpath.toIndexedSeq, converter = converter, options = args.toSeq, initialCommands = "", diff --git a/internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala b/internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala index 693a0523f..d3506f73d 100644 --- a/internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala +++ b/internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala @@ -191,14 +191,29 @@ object ClassToAPI { cmap: ClassMap ): (api.Structure, api.Structure) = { lazy val cf = classFileForClass(c) - val methods = mergeMap(c, c.getDeclaredMethods, c.getMethods, methodToDef(enclPkg)) - val fields = mergeMap(c, c.getDeclaredFields, c.getFields, fieldToDef(c, cf, enclPkg)) + val methods = mergeMap( + c, + c.getDeclaredMethods.toIndexedSeq, + c.getMethods.toIndexedSeq, + methodToDef(enclPkg) + ) + val fields = mergeMap( + c, + c.getDeclaredFields.toIndexedSeq, + c.getFields.toIndexedSeq, + fieldToDef(c, cf, enclPkg) + ) val constructors = - mergeMap(c, c.getDeclaredConstructors, c.getConstructors, constructorToDef(enclPkg)) + mergeMap( + c, + c.getDeclaredConstructors.toIndexedSeq, + c.getConstructors.toIndexedSeq, + constructorToDef(enclPkg) + ) val classes = merge[Class[?]]( c, - c.getDeclaredClasses, - c.getClasses, + c.getDeclaredClasses.toIndexedSeq, + c.getClasses.toIndexedSeq, toDefinitions(cmap), (_: Seq[Class[?]]).partition(isStatic), _.getEnclosingClass != c @@ -240,7 +255,7 @@ object ClassToAPI { private def allSuperTypes(t: Type): Seq[Type] = { @tailrec def accumulate(t: Type, accum: Seq[Type] = Seq.empty): Seq[Type] = t match { case c: Class[?] => - val (parent, interfaces) = (c.getGenericSuperclass, c.getGenericInterfaces) + val (parent, interfaces) = (c.getGenericSuperclass, c.getGenericInterfaces.toIndexedSeq) accumulate(parent, (accum :+ parent) ++ flattenAll(interfaces)) case p: ParameterizedType => accumulate(p.getRawType, accum) @@ -263,7 +278,7 @@ object ClassToAPI { def types(ts: Seq[Type]): Array[api.Type] = ts.filter(_ ne null).map(reference).toArray def upperBounds(ts: Array[Type]): api.Type = - api.Structure.of(lzy(types(ts)), lzyEmptyDefArray, lzyEmptyDefArray) + api.Structure.of(lzy(types(ts.toIndexedSeq)), lzyEmptyDefArray, lzyEmptyDefArray) @deprecated("No longer used", "0.13.0") def parents(c: Class[?]): Seq[api.Type] = types(allSuperTypes(c)) diff --git a/internal/zinc-apiinfo/src/main/scala/xsbt/api/Discovery.scala b/internal/zinc-apiinfo/src/main/scala/xsbt/api/Discovery.scala index 9801e89e3..e5e0313d2 100644 --- a/internal/zinc-apiinfo/src/main/scala/xsbt/api/Discovery.scala +++ b/internal/zinc-apiinfo/src/main/scala/xsbt/api/Discovery.scala @@ -66,7 +66,7 @@ object Discovery { simpleName(a.base).filter(pred) }.toSet def defAnnotations(s: Structure, pred: String => Boolean): Set[String] = - defAnnotations(s.declared.toIndexedSeq, pred) ++ defAnnotations(s.inherited, pred) + defAnnotations(s.declared.toIndexedSeq, pred) ++ defAnnotations(s.inherited.toIndexedSeq, pred) def defAnnotations(defs: Seq[Definition], pred: String => Boolean): Set[String] = findAnnotations( defs.flatMap { diff --git a/internal/zinc-apiinfo/src/main/scala/xsbt/api/HashAPI.scala b/internal/zinc-apiinfo/src/main/scala/xsbt/api/HashAPI.scala index 875254059..90349cac3 100644 --- a/internal/zinc-apiinfo/src/main/scala/xsbt/api/HashAPI.scala +++ b/internal/zinc-apiinfo/src/main/scala/xsbt/api/HashAPI.scala @@ -432,8 +432,8 @@ final class HashAPI private ( extend(StructureHash) hashTypes(structure.parents, includeDefinitions) if (includeDefinitions) { - hashDefinitions(structure.declared, false, isTrait) - hashDefinitions(structure.inherited, false, isTrait) + hashDefinitions(structure.declared.toIndexedSeq, false, isTrait) + hashDefinitions(structure.inherited.toIndexedSeq, false, isTrait) } } def hashParameters(parameters: Array[TypeParameter], base: Type): Unit = { diff --git a/internal/zinc-apiinfo/src/main/scala/xsbt/api/SameAPI.scala b/internal/zinc-apiinfo/src/main/scala/xsbt/api/SameAPI.scala index bc926caa5..8049d611f 100644 --- a/internal/zinc-apiinfo/src/main/scala/xsbt/api/SameAPI.scala +++ b/internal/zinc-apiinfo/src/main/scala/xsbt/api/SameAPI.scala @@ -139,7 +139,10 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { // a.name == b.name && debug(sameAccess(a.access, b.access), "Access differed") && debug(sameModifiers(a.modifiers, b.modifiers), "Modifiers differed") && - debug(sameAnnotations(a.annotations, b.annotations), "Annotations differed") && + debug( + sameAnnotations(a.annotations.toIndexedSeq, b.annotations.toIndexedSeq), + "Annotations differed" + ) && debug(sameDefinitionSpecificAPI(a, b), "Definition-specific differed") } @@ -184,7 +187,7 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { def sameAnnotation(a: Annotation, b: Annotation): Boolean = debug(sameType(a.base, b.base), "Annotation base type differed") && debug( - sameAnnotationArguments(a.arguments, b.arguments), + sameAnnotationArguments(a.arguments.toIndexedSeq, b.arguments.toIndexedSeq), "Annotation arguments differed (" + a + ") and (" + b + ")" ) def sameAnnotationArguments(a: Seq[AnnotationArgument], b: Seq[AnnotationArgument]): Boolean = @@ -203,7 +206,7 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { def sameParameterizedDefinition(a: ParameterizedDefinition, b: ParameterizedDefinition): Boolean = debug( - sameTypeParameters(a.typeParameters, b.typeParameters), + sameTypeParameters(a.typeParameters.toIndexedSeq, b.typeParameters.toIndexedSeq), "Different type parameters for " + a.name ) && sameParameterizedSpecificAPI(a, b) @@ -222,7 +225,7 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { def sameDefSpecificAPI(a: Def, b: Def): Boolean = debug( - sameValueParameters(a.valueParameters, b.valueParameters), + sameValueParameters(a.valueParameters.toIndexedSeq, b.valueParameters.toIndexedSeq), "Different def value parameters for " + a.name ) && debug(sameType(a.returnType, b.returnType), "Different def return type for " + a.name) @@ -253,7 +256,7 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { debug(sameTopLevel(a, b), "Top level flag differs") && sameDefinitionType(a.definitionType, b.definitionType) && sameType(a.selfType, b.selfType) && - sameSeq(a.childrenOfSealedClass, b.childrenOfSealedClass)(sameType) && + sameSeq(a.childrenOfSealedClass.toIndexedSeq, b.childrenOfSealedClass.toIndexedSeq)(sameType) && sameStructure(a.structure, b.structure) } @@ -265,7 +268,7 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { def sameParameterList(a: ParameterList, b: ParameterList): Boolean = (a.isImplicit == b.isImplicit) && - sameParameters(a.parameters, b.parameters) + sameParameters(a.parameters.toIndexedSeq, b.parameters.toIndexedSeq) def sameParameters(a: Seq[MethodParameter], b: Seq[MethodParameter]): Boolean = sameSeq(a, b)(sameMethodParameter) def sameMethodParameter(a: MethodParameter, b: MethodParameter): Boolean = @@ -283,8 +286,11 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { def sameTypeParameters(a: Seq[TypeParameter], b: Seq[TypeParameter]): Boolean = debug(sameSeq(a, b)(sameTypeParameter), "Different type parameters") def sameTypeParameter(a: TypeParameter, b: TypeParameter): Boolean = { - sameTypeParameters(a.typeParameters, b.typeParameters) && - debug(sameAnnotations(a.annotations, b.annotations), "Different type parameter annotations") && + sameTypeParameters(a.typeParameters.toIndexedSeq, b.typeParameters.toIndexedSeq) && + debug( + sameAnnotations(a.annotations.toIndexedSeq, b.annotations.toIndexedSeq), + "Different type parameter annotations" + ) && debug(sameVariance(a.variance, b.variance), "Different variance") && debug(sameType(a.lowerBound, b.lowerBound), "Different lower bound") && debug(sameType(a.upperBound, b.upperBound), "Different upper bound") && @@ -326,14 +332,14 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { sameType(ca.baseType, cb.baseType) && ca.value == cb.value def sameExistentialType(a: Existential, b: Existential): Boolean = - sameTypeParameters(a.clause, b.clause) && + sameTypeParameters(a.clause.toIndexedSeq, b.clause.toIndexedSeq) && sameType(a.baseType, b.baseType) def samePolymorphicType(a: Polymorphic, b: Polymorphic): Boolean = - sameTypeParameters(a.parameters, b.parameters) && + sameTypeParameters(a.parameters.toIndexedSeq, b.parameters.toIndexedSeq) && sameType(a.baseType, b.baseType) def sameAnnotatedType(a: Annotated, b: Annotated): Boolean = sameType(a.baseType, b.baseType) && - sameAnnotations(a.annotations, b.annotations) + sameAnnotations(a.annotations.toIndexedSeq, b.annotations.toIndexedSeq) def sameStructure(a: Structure, b: Structure): Boolean = samePending(a, b)(sameStructureDirect) @@ -341,9 +347,9 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { if (pending add ((a, b))) f(a, b) else true def sameStructureDirect(a: Structure, b: Structure): Boolean = { - sameSeq(a.parents, b.parents)(sameType) && - sameMembers(a.declared, b.declared) && - sameMembers(a.inherited, b.inherited) + sameSeq(a.parents.toIndexedSeq, b.parents.toIndexedSeq)(sameType) && + sameMembers(a.declared.toIndexedSeq, b.declared.toIndexedSeq) && + sameMembers(a.inherited.toIndexedSeq, b.inherited.toIndexedSeq) } def sameMembers(a: Seq[Definition], b: Seq[Definition]): Boolean = @@ -358,7 +364,7 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { def sameParameterized(a: Parameterized, b: Parameterized): Boolean = sameType(a.baseType, b.baseType) && - sameSeq(a.typeArguments, b.typeArguments)(sameType) + sameSeq(a.typeArguments.toIndexedSeq, b.typeArguments.toIndexedSeq)(sameType) def sameParameterRef(a: ParameterRef, b: ParameterRef): Boolean = sameTags(a.id, b.id) def sameSingleton(a: Singleton, b: Singleton): Boolean = samePath(a.path, b.path) @@ -367,7 +373,7 @@ class SameAPI(includePrivate: Boolean, includeParamNames: Boolean) { (a.id == b.id) def samePath(a: Path, b: Path): Boolean = - samePathComponents(a.components, b.components) + samePathComponents(a.components.toIndexedSeq, b.components.toIndexedSeq) def samePathComponents(a: Seq[PathComponent], b: Seq[PathComponent]): Boolean = sameSeq(a, b)(samePathComponent) def samePathComponent(a: PathComponent, b: PathComponent): Boolean = diff --git a/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/Parser.scala b/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/Parser.scala index 01744c109..edbc7c3da 100644 --- a/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/Parser.scala +++ b/internal/zinc-classfile/src/main/scala/sbt/internal/inc/classfile/Parser.scala @@ -106,7 +106,7 @@ private[sbt] object Parser { in.readUnsignedShort(), toString(in.readUnsignedShort()), toString(in.readUnsignedShort()), - array(in.readUnsignedShort())(parseAttribute()) + array(in.readUnsignedShort())(parseAttribute()).toIndexedSeq ) private def parseAttribute() = { val nameIndex = in.readUnsignedShort() diff --git a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ScalaInstance.scala b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ScalaInstance.scala index 41ee277c2..b28230152 100644 --- a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ScalaInstance.scala +++ b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ScalaInstance.scala @@ -266,7 +266,7 @@ object ScalaInstance { /** Return all the required Scala jars from a path `scalaHome`. */ def allJars(scalaHome: File): Seq[File] = - IO.listFiles(scalaLib(scalaHome)).filter(f => !blacklist(f.getName)) + IO.listFiles(scalaLib(scalaHome)).toIndexedSeq.filter(f => !blacklist(f.getName)) private[this] def scalaLib(scalaHome: File): File = new File(scalaHome, "lib") diff --git a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/classpath/ClasspathUtilities.scala b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/classpath/ClasspathUtilities.scala index 944e15f7f..aea685817 100644 --- a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/classpath/ClasspathUtilities.scala +++ b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/classpath/ClasspathUtilities.scala @@ -81,7 +81,7 @@ object ClasspathUtil { classpath: Seq[Path], instance: ScalaInstance ): Map[String, String] = { - createClasspathResources(classpath, instance.libraryJars.map(_.toPath)) + createClasspathResources(classpath, instance.libraryJars.toIndexedSeq.map(_.toPath)) } def createClasspathResources(appPaths: Seq[Path], bootPaths: Seq[Path]): Map[String, String] = {