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 2a91f0cf8..693a0523f 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 @@ -507,11 +507,11 @@ object ClassToAPI { * We need this logic to trigger recompilation due to changes to pattern exhaustivity checking results. */ private def childrenOfSealedClass(c: Class[?]): Seq[api.Type] = - if (!c.isEnum) emptyTypeArray + if (!c.isEnum) emptyTypeArray.toIndexedSeq else { // Calling getCanonicalName() on classes from enum constants yields same string as enumClazz.getCanonicalName // Moreover old behaviour create new instance of enum - what may fail (e.g. in static block ) - Array(reference(c)) + Seq(reference(c)) } // full information not available from reflection @@ -556,7 +556,7 @@ object ClassToAPI { } def pathFromString(s: String): api.Path = - pathFromStrings(s.split("\\.")) + pathFromStrings(s.split("\\.").toIndexedSeq) def pathFromStrings(ss: Seq[String]): api.Path = api.Path.of((ss.map(api.Id.of(_)) :+ ThisRef).toArray) def packageName(c: Class[?]) = packageAndName(c)._1 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 608a1c8da..9801e89e3 100644 --- a/internal/zinc-apiinfo/src/main/scala/xsbt/api/Discovery.scala +++ b/internal/zinc-apiinfo/src/main/scala/xsbt/api/Discovery.scala @@ -34,13 +34,13 @@ class Discovery(baseClasses: Set[String], annotations: Set[String]) { case _ => Discovered.empty } def discover(c: ClassLike): Discovered = { - val onClass = Discovery.findAnnotations(c.annotations, annotations) + val onClass = Discovery.findAnnotations(c.annotations.toIndexedSeq, annotations) val onDefs = Discovery.defAnnotations(c.structure, annotations) ++ c.savedAnnotations.filter( annotations ) val module = isModule(c) new Discovered( - bases(c.name, c.structure.parents), + bases(c.name, c.structure.parents.toIndexedSeq), onClass ++ onDefs, module && hasMainMethod(c), module @@ -66,7 +66,7 @@ object Discovery { simpleName(a.base).filter(pred) }.toSet def defAnnotations(s: Structure, pred: String => Boolean): Set[String] = - defAnnotations(s.declared, pred) ++ defAnnotations(s.inherited, pred) + defAnnotations(s.declared.toIndexedSeq, pred) ++ defAnnotations(s.inherited, pred) def defAnnotations(defs: Seq[Definition], pred: String => Boolean): Set[String] = findAnnotations( defs.flatMap { @@ -82,19 +82,21 @@ object Discovery { def isModule(c: ClassLike) = c.definitionType == DefinitionType.Module def hasMainMethod(c: ClassLike): Boolean = - hasMainMethod(c.structure.declared) || hasMainMethod(c.structure.inherited) + hasMainMethod(c.structure.declared.toIndexedSeq) || hasMainMethod( + c.structure.inherited.toIndexedSeq + ) def hasMainMethod(defs: Seq[Definition]): Boolean = defs.exists(isMainMethod) def isMainMethod(d: Definition): Boolean = d match { case d: Def => d.name == "main" && isPublic(d) && isConcrete(d) && isUnit(d.returnType) && isStringArray( - d.valueParameters + d.valueParameters.toIndexedSeq ) case _ => false } def isStringArray(vp: IndexedSeq[ParameterList]): Boolean = - vp.length == 1 && isStringArray(vp(0).parameters) + vp.length == 1 && isStringArray(vp(0).parameters.toIndexedSeq) def isStringArray(params: Seq[MethodParameter]): Boolean = params.length == 1 && isStringArray(params(0)) def isStringArray(p: MethodParameter): Boolean = diff --git a/internal/zinc-apiinfo/src/main/scala/xsbt/api/ShowAPI.scala b/internal/zinc-apiinfo/src/main/scala/xsbt/api/ShowAPI.scala index 3c706b8b6..14ae4f456 100644 --- a/internal/zinc-apiinfo/src/main/scala/xsbt/api/ShowAPI.scala +++ b/internal/zinc-apiinfo/src/main/scala/xsbt/api/ShowAPI.scala @@ -41,12 +41,14 @@ object ShowAPI { case v: Val => showMonoDef(v, "val") + ": " + showType(v.tpe) case v: Var => showMonoDef(v, "var") + ": " + showType(v.tpe) case d: Def => - showPolyDef(d, "def") + showValueParams(d.valueParameters) + ": " + showType(d.returnType) + showPolyDef(d, "def") + showValueParams(d.valueParameters.toIndexedSeq) + ": " + showType( + d.returnType + ) case ta: TypeAlias => showPolyDef(ta, "type") + " = " + showType(ta.tpe) case td: TypeDeclaration => showPolyDef(td, "type") + showBounds(td.lowerBound, td.upperBound) case cl: ClassLike => showMonoDef(d, showDefinitionType(cl.definitionType)) + - showTypeParameters(cl.typeParameters) + " extends " + showTemplate(cl) + showTypeParameters(cl.typeParameters.toIndexedSeq) + " extends " + showTemplate(cl) case cl: ClassLikeDef => showPolyDef(cl, showDefinitionType(cl.definitionType)) } @@ -59,9 +61,11 @@ object ShowAPI { cl.structure.parents.map(showNestedType).mkString("", " with ", " {") + showSelf + lines( - truncateDecls(cl.structure.inherited).map(d => "^inherited^ " + showNestedDefinition(d)) + truncateDecls(cl.structure.inherited).toIndexedSeq.map(d => + "^inherited^ " + showNestedDefinition(d) + ) ) + - lines(truncateDecls(cl.structure.declared).map(showNestedDefinition)) + + lines(truncateDecls(cl.structure.declared).toIndexedSeq.map(showNestedDefinition)) + "}" } @@ -73,7 +77,7 @@ object ShowAPI { case p: Parameterized => showType(p.baseType) + p.typeArguments.map(showType).mkString("[", ", ", "]") case c: Constant => showType(c.baseType) + "(" + c.value + ")" - case a: Annotated => showAnnotations(a.annotations) + " " + showType(a.baseType) + case a: Annotated => showAnnotations(a.annotations.toIndexedSeq) + " " + showType(a.baseType) case s: Structure => s.parents.map(showType).mkString(" with ") + ( if (nesting <= 0) "{ }" @@ -90,7 +94,7 @@ object ShowAPI { case p: Polymorphic => showType(p.baseType) + ( if (nesting <= 0) " [ ]" - else showNestedTypeParameters(p.parameters) + else showNestedTypeParameters(p.parameters.toIndexedSeq) ) } @@ -103,22 +107,22 @@ object ShowAPI { private def space(s: String) = if (s.isEmpty) s else s + " " private def showMonoDef(d: Definition, label: String)(implicit nesting: Int): String = - space(showAnnotations(d.annotations)) + space(showAccess(d.access)) + space( + space(showAnnotations(d.annotations.toIndexedSeq)) + space(showAccess(d.access)) + space( showModifiers(d.modifiers) ) + space(label) + d.name private def showPolyDef(d: ParameterizedDefinition, label: String)( implicit nesting: Int ): String = - showMonoDef(d, label) + showTypeParameters(d.typeParameters) + showMonoDef(d, label) + showTypeParameters(d.typeParameters.toIndexedSeq) private def showTypeParameters(tps: Seq[TypeParameter])(implicit nesting: Int): String = if (tps.isEmpty) "" else tps.map(showTypeParameter).mkString("[", ", ", "]") private def showTypeParameter(tp: TypeParameter)(implicit nesting: Int): String = - showAnnotations(tp.annotations) + " " + showVariance(tp.variance) + tp.id + showTypeParameters( - tp.typeParameters + showAnnotations(tp.annotations.toIndexedSeq) + " " + showVariance(tp.variance) + tp.id + showTypeParameters( + tp.typeParameters.toIndexedSeq ) + " " + showBounds(tp.lowerBound, tp.upperBound) private def showAnnotations(as: Seq[Annotation])(implicit nesting: Int) = diff --git a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerArguments.scala b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerArguments.scala index f490e9150..c6834ada4 100644 --- a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerArguments.scala +++ b/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/CompilerArguments.scala @@ -88,7 +88,8 @@ final class CompilerArguments( */ def finishClasspath(classpath: Seq[Path]): Seq[Path] = { val filteredClasspath = filterLibrary(classpath) - val extraCompiler = include(cpOptions.compiler, scalaInstance.compilerJars.map(_.toPath): _*) + val extraCompiler = + include(cpOptions.compiler, scalaInstance.compilerJars.toIndexedSeq.map(_.toPath): _*) val otherJars = scalaInstance.otherJars.toList.map(_.toPath) val extraClasspath = include(cpOptions.extra, otherJars: _*) filteredClasspath ++ extraCompiler ++ extraClasspath