Fix several warnings

This commit is contained in:
Pierre DAL-PRA 2015-07-17 08:30:13 +02:00
parent 4abc8386f2
commit 13b37cc987
13 changed files with 23 additions and 23 deletions

View File

@ -26,7 +26,7 @@ object ClassToAPI {
}
// Avoiding implicit allocation.
private def arrayMap[T <: AnyRef, U <: AnyRef: ClassManifest](xs: Array[T])(f: T => U): Array[U] = {
private def arrayMap[T <: AnyRef, U <: AnyRef: reflect.ClassTag](xs: Array[T])(f: T => U): Array[U] = {
val len = xs.length
var i = 0
val res = new Array[U](len)

View File

@ -5,7 +5,6 @@ import java.lang.ref.{ SoftReference, Reference }
import sbt.classfile.Analyze
import sbt.classpath.ClasspathUtilities
import sbt.compiler.CompileConfiguration
import sbt.compiler.javac.AnalyzingJavaCompiler
import sbt.inc.Locate.DefinesClass
import sbt._

View File

@ -126,7 +126,7 @@ final class AnalyzingCompiler private (val scalaInstance: xsbti.compile.ScalaIns
object AnalyzingCompiler {
import sbt.IO.{ copy, createDirectory, zip, jars, unzip, withTemporaryDirectory }
// Note: The Scala build now depends on some details of this method:
// Note: The Scala build now depends on some details of this method:
// https://github.com/jsuereth/scala/commit/3431860048df8d2a381fb85a526097e00154eae0
/**
* Extract sources from source jars, compile them with the xsbti interfaces on the classpath, and package the compiled classes and
@ -147,7 +147,7 @@ object AnalyzingCompiler {
log.info(" Compilation completed in " + (System.currentTimeMillis - start) / 1000.0 + " s")
} catch { case e: xsbti.CompileFailed => throw new CompileFailed(e.arguments, "Error compiling sbt component '" + id + "'", e.problems) }
import sbt.Path._
copy(resources x rebase(dir, outputDirectory))
copy(resources pair rebase(dir, outputDirectory))
zip((outputDirectory ***) x_! relativeTo(outputDirectory), targetJar)
}
}

View File

@ -4,7 +4,7 @@ import java.io.File;
import xsbti.Logger;
import xsbti.Reporter;
/**
/**
* Interface to a Java compiler.
*/
public interface JavaCompiler
@ -14,6 +14,7 @@ public interface JavaCompiler
*
* @deprecated 0.13.8 - Use compileWithReporter instead
*/
@Deprecated
void compile(File[] sources, File[] classpath, Output output, String[] options, Logger log);
/**
@ -23,4 +24,4 @@ public interface JavaCompiler
* Failures should be passed to the provided Reporter.
*/
void compileWithReporter(File[] sources, File[] classpath, Output output, String[] options, Reporter reporter, Logger log);
}
}

View File

@ -109,7 +109,7 @@ private final class MergedDescriptors(a: DependencyDescriptor, b: DependencyDesc
private[this] def addConfigurations(dd: DefaultDependencyArtifactDescriptor, confs: Seq[String]): Unit =
confs foreach dd.addConfiguration
private[this] def concat[T: ClassManifest](a: Array[T], b: Array[T]): Array[T] = (a ++ b).distinct.toArray
private[this] def concat[T: reflect.ClassTag](a: Array[T], b: Array[T]): Array[T] = (a ++ b).distinct.toArray
def getAllExcludeRules = concat(a.getAllExcludeRules, b.getAllExcludeRules)

View File

@ -274,7 +274,7 @@ object BasicCommands {
val aliasRemoved = removeAlias(state, name)
// apply the alias value to the commands of `state` except for the alias to avoid recursion (#933)
val partiallyApplied = Parser(Command.combine(aliasRemoved.definedCommands)(aliasRemoved))(value)
val arg = matched(partiallyApplied & (success() | (SpaceClass ~ any.*)))
val arg = matched(partiallyApplied & (success(()) | (SpaceClass ~ any.*)))
// by scheduling the expanded alias instead of directly executing, we get errors on the expanded string (#598)
arg.map(str => () => (value + str) :: state)
}

View File

@ -1853,7 +1853,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
def addArtifact(a: Artifact, taskDef: TaskKey[File]): SettingsDefinition =
{
val pkgd = packagedArtifacts := packagedArtifacts.value updated (a, taskDef.value)
seq(artifacts += a, pkgd)
Seq(artifacts += a, pkgd)
}
/** Constructs a setting that declares a new artifact `artifact` that is generated by `taskDef`. */
def addArtifact(artifact: Initialize[Artifact], taskDef: Initialize[Task[File]]): SettingsDefinition =
@ -1862,7 +1862,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
val taskLocal = TaskKey.local[File]
val art = artifacts := artLocal.value +: artifacts.value
val pkgd = packagedArtifacts := packagedArtifacts.value updated (artLocal.value, taskLocal.value)
seq(artLocal := artifact.value, taskLocal := taskDef.value, art, pkgd)
Seq(artLocal := artifact.value, taskLocal := taskDef.value, art, pkgd)
}
// because this was commonly used, this might need to be kept longer than usual

View File

@ -133,7 +133,7 @@ object Load {
val settings = finalTransforms(buildConfigurations(loaded, getRootProject(projects), config.injectSettings))
val delegates = config.delegates(loaded)
val data = Def.make(settings)(delegates, config.scopeLocal, Project.showLoadingKey(loaded))
Project.checkTargets(data) foreach error
Project.checkTargets(data) foreach sys.error
val index = structureIndex(data, settings, loaded.extra(data), projects)
val streams = mkStreams(projects, loaded.root, data)
(rootEval, new sbt.BuildStructure(projects, loaded.root, settings, data, index, streams, delegates, config.scopeLocal))

View File

@ -24,7 +24,7 @@ object PluginDiscovery {
/** Discovers and loads the sbt-plugin-related top-level modules from the classpath and source analysis in `data` and using the provided class `loader`. */
def discoverAll(data: PluginData, loader: ClassLoader): DetectedPlugins =
{
def discover[T](resource: String)(implicit mf: reflect.ClassManifest[T]) =
def discover[T](resource: String)(implicit classTag: reflect.ClassTag[T]) =
binarySourceModules[T](data, loader, resource)
import Paths._
// TODO - Fix this once we can autodetect AutoPlugins defined by sbt itself.
@ -45,8 +45,8 @@ object PluginDiscovery {
/** Discovers the sbt-plugin-related top-level modules from the provided source `analysis`. */
def discoverSourceAll(analysis: inc.Analysis): DiscoveredNames =
{
def discover[T](implicit mf: reflect.ClassManifest[T]): Seq[String] =
sourceModuleNames(analysis, mf.erasure.getName)
def discover[T](implicit classTag: reflect.ClassTag[T]): Seq[String] =
sourceModuleNames(analysis, classTag.runtimeClass.getName)
new DiscoveredNames(discover[Plugin], discover[AutoPlugin], discover[Build])
}
@ -115,17 +115,17 @@ object PluginDiscovery {
def onClasspath(classpath: Seq[File])(url: URL): Boolean =
IO.urlAsFile(url) exists (classpath.contains _)
private[sbt] def binarySourceModules[T](data: PluginData, loader: ClassLoader, resourceName: String)(implicit mf: reflect.ClassManifest[T]): DetectedModules[T] =
private[sbt] def binarySourceModules[T](data: PluginData, loader: ClassLoader, resourceName: String)(implicit classTag: reflect.ClassTag[T]): DetectedModules[T] =
{
val classpath = data.classpath
val namesAndValues = if (classpath.isEmpty) Nil else {
val names = binarySourceModuleNames(classpath, loader, resourceName, mf.erasure.getName)
val names = binarySourceModuleNames(classpath, loader, resourceName, classTag.runtimeClass.getName)
loadModules[T](data, names, loader)
}
new DetectedModules(namesAndValues)
}
private[this] def loadModules[T: ClassManifest](data: PluginData, names: Seq[String], loader: ClassLoader): Seq[(String, T)] =
private[this] def loadModules[T: reflect.ClassTag](data: PluginData, names: Seq[String], loader: ClassLoader): Seq[(String, T)] =
try ModuleUtilities.getCheckedObjects[T](names, loader)
catch {
case e: ExceptionInInitializerError =>
@ -143,4 +143,4 @@ object PluginDiscovery {
val msgExtra = if (evictedStrings.isEmpty) "" else "\nNote that conflicts were resolved for some dependencies:\n\t" + evictedStrings.mkString("\n\t")
throw new IncompatiblePluginsException(msgBase + msgExtra, t)
}
}
}

View File

@ -141,7 +141,7 @@ sealed trait Project extends ProjectDefinition[ProjectReference] {
def aggregate(refs: ProjectReference*): Project = copy(aggregate = (aggregate: Seq[ProjectReference]) ++ refs)
/** Appends settings to the current settings sequence for this project. */
def settings(ss: SettingsDefinition*): Project = copy(settings = (settings: Seq[Setting[_]]) ++ ss.flatMap(_.settings))
def settings(ss: SettingsDefinition*): Project = copy(settings = (settings: Seq[Def.Setting[_]]) ++ ss.flatMap(_.settings))
@deprecated("Use settingSets method.", "0.13.5")
def autoSettings(select: AddSettings*): Project = settingSets(select.toSeq: _*)

View File

@ -112,7 +112,7 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler {
case paths =>
val mapped = fromStrings(paths)
val map = mapper(mapped.last)
IO.copy(mapped.init x map)
IO.copy(mapped.init pair map)
}
def wrongArguments(args: List[String]): Some[String] =
scriptError("Command '" + commandName + "' does not accept arguments (found '" + spaced(args) + "').")

View File

@ -17,8 +17,8 @@ object ModuleUtilities {
}
def getCheckedObject[T](className: String, loader: ClassLoader)(implicit mf: reflect.ClassManifest[T]): T =
mf.erasure.cast(getObject(className, loader)).asInstanceOf[T]
mf.runtimeClass.cast(getObject(className, loader)).asInstanceOf[T]
def getCheckedObjects[T](classNames: Seq[String], loader: ClassLoader)(implicit mf: reflect.ClassManifest[T]): Seq[(String, T)] =
classNames.map(name => (name, getCheckedObject(name, loader)))
}
}

View File

@ -571,7 +571,7 @@ object IO {
* Any parent directories that do not exist are created.
*/
def copyDirectory(source: File, target: File, overwrite: Boolean = false, preserveLastModified: Boolean = false): Unit =
copy((PathFinder(source) ***) x Path.rebase(source, target), overwrite, preserveLastModified)
copy((PathFinder(source) ***) pair Path.rebase(source, target), overwrite, preserveLastModified)
/**
* Copies the contents of `sourceFile` to the location of `targetFile`, overwriting any existing content.