From e48f6ade30d4ee8cedf69d00c5cc877adef38658 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Sat, 18 Jun 2016 01:44:13 +0200 Subject: [PATCH] Cleanup actionsProj --- main-actions/src/main/scala/sbt/Doc.scala | 7 ++++--- main-actions/src/main/scala/sbt/DotGraph.scala | 6 +++--- main-actions/src/main/scala/sbt/ForkTests.scala | 2 +- main-actions/src/main/scala/sbt/Sync.scala | 2 +- main-actions/src/main/scala/sbt/compiler/Eval.scala | 13 ++++++------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/main-actions/src/main/scala/sbt/Doc.scala b/main-actions/src/main/scala/sbt/Doc.scala index bbcde8a64..f6d9477f0 100644 --- a/main-actions/src/main/scala/sbt/Doc.scala +++ b/main-actions/src/main/scala/sbt/Doc.scala @@ -44,12 +44,13 @@ object Doc { // def apply(maximumErrors: Int, compiler: sbt.compiler.Javadoc) = new Javadoc(maximumErrors, compiler) private[sbt] final class Scaladoc(maximumErrors: Int, compiler: AnalyzingCompiler) extends Doc { - def apply(label: String, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], log: Logger) { + def apply(label: String, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], log: Logger): Unit = { generate("Scala", label, compiler.doc, sources, classpath, outputDirectory, options, maximumErrors, log) } } + // TODO: trait Javadoc in package inc is deprecated: Please use the new set of compilers in sbt.compilers.javac private[sbt] final class Javadoc(maximumErrors: Int, doc: sbt.internal.inc.Javadoc) extends Doc { - def apply(label: String, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], log: Logger) { + def apply(label: String, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], log: Logger): Unit = { // javadoc doesn't handle *.scala properly, so we evict them from javadoc sources list. generate("Java", label, doc.doc, sources.filterNot(_.name.endsWith(".scala")), classpath, outputDirectory, options, maximumErrors, log) } @@ -61,7 +62,7 @@ sealed trait Doc { // def apply(label: String, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], log: Logger): Unit - private[sbt] final def generate(variant: String, label: String, docf: Gen, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], maxErrors: Int, log: Logger) { + private[sbt] final def generate(variant: String, label: String, docf: Gen, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String], maxErrors: Int, log: Logger): Unit = { val logSnip = variant + " API documentation" if (sources.isEmpty) log.info("No sources available, skipping " + logSnip + "...") diff --git a/main-actions/src/main/scala/sbt/DotGraph.scala b/main-actions/src/main/scala/sbt/DotGraph.scala index 852e25335..4d40ecaf9 100644 --- a/main-actions/src/main/scala/sbt/DotGraph.scala +++ b/main-actions/src/main/scala/sbt/DotGraph.scala @@ -20,7 +20,7 @@ object DotGraph { def packages(relations: Relations, outputDirectory: File, sourceRoots: Iterable[File]): Unit = { val packageOnly = (path: String) => { - val last = path.lastIndexOf(File.separatorChar) + val last = path.lastIndexOf(File.separatorChar.toInt) val packagePath = (if (last > 0) path.substring(0, last) else path).trim if (packagePath.isEmpty) "" else packagePath.replace(File.separatorChar, '.') } @@ -34,8 +34,8 @@ object DotGraph { generateGraph(file("binary-dependencies"), "externalDependencies", relations.binaryDep, externalToString, sourceToString) } - def generateGraph[Key, Value](file: File, graphName: String, relation: Relation[Key, Value], - keyToString: Key => String, valueToString: Value => String) { + def generateGraph[K, V](file: File, graphName: String, relation: Relation[K, V], + keyToString: K => String, valueToString: V => String): Unit = { import scala.collection.mutable.{ HashMap, HashSet } val mappedGraph = new HashMap[String, HashSet[String]] for ((key, values) <- relation.forwardMap; keyString = keyToString(key); value <- values) diff --git a/main-actions/src/main/scala/sbt/ForkTests.scala b/main-actions/src/main/scala/sbt/ForkTests.scala index 6f78fee90..fa2fd0d8e 100755 --- a/main-actions/src/main/scala/sbt/ForkTests.scala +++ b/main-actions/src/main/scala/sbt/ForkTests.scala @@ -42,7 +42,7 @@ private[sbt] object ForkTests { val resultsAcc = mutable.Map.empty[String, SuiteResult] lazy val result = TestOutput(overall(resultsAcc.values.map(_.result)), resultsAcc.toMap, Iterable.empty) - def run() { + def run(): Unit = { val socket = try { server.accept() diff --git a/main-actions/src/main/scala/sbt/Sync.scala b/main-actions/src/main/scala/sbt/Sync.scala index 9f6f25c06..df23912ad 100644 --- a/main-actions/src/main/scala/sbt/Sync.scala +++ b/main-actions/src/main/scala/sbt/Sync.scala @@ -59,7 +59,7 @@ object Sync { IO.copyLastModified(source, target) } - def noDuplicateTargets(relation: Relation[File, File]) { + def noDuplicateTargets(relation: Relation[File, File]): Unit = { val dups = relation.reverseMap.filter { case (target, srcs) => srcs.size >= 2 && srcs.exists(!_.isDirectory) diff --git a/main-actions/src/main/scala/sbt/compiler/Eval.scala b/main-actions/src/main/scala/sbt/compiler/Eval.scala index fcaaa2b8f..a54d0807b 100644 --- a/main-actions/src/main/scala/sbt/compiler/Eval.scala +++ b/main-actions/src/main/scala/sbt/compiler/Eval.scala @@ -3,11 +3,10 @@ package compiler import scala.reflect.Manifest import scala.tools.nsc.{ ast, interpreter, io, reporters, util, CompilerCommand, Global, Phase, Settings } -import interpreter.AbstractFileClassLoader import io.{ AbstractFile, PlainFile, VirtualDirectory } import ast.parser.Tokens import reporters.{ ConsoleReporter, Reporter } -import scala.reflect.internal.util.BatchSourceFile +import scala.reflect.internal.util.{ AbstractFileClassLoader, BatchSourceFile } import Tokens.{ EOF, NEWLINE, NEWLINES, SEMI } import java.io.File import java.nio.ByteBuffer @@ -90,7 +89,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se val tpt: Tree = expectedType(tpeName) augment(parser, importTrees, tree, tpt, moduleName) } - def extra(run: Run, unit: CompilationUnit) = atPhase(run.typerPhase.next) { (new TypeExtractor).getType(unit.body) } + def extra(run: Run, unit: CompilationUnit) = enteringPhase(run.typerPhase.next) { (new TypeExtractor).getType(unit.body) } def read(file: File) = IO.read(file) def write(value: String, f: File) = IO.write(f, value) def extraHash = "" @@ -112,7 +111,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se syntheticModule(fullParser, importTrees, trees.toList, moduleName) } def extra(run: Run, unit: CompilationUnit) = { - atPhase(run.typerPhase.next) { (new ValExtractor(valTypes.toSet)).getVals(unit.body) } + enteringPhase(run.typerPhase.next) { (new ValExtractor(valTypes.toSet)).getVals(unit.body) } } def read(file: File) = IO.readLines(file) def write(value: Seq[String], file: File) = IO.writeLines(file, value) @@ -176,7 +175,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se if (phase == null || phase == phase.next || reporter.hasErrors) () else { - atPhase(phase) { phase.run } + enteringPhase(phase) { phase.run } compile(phase.next) } } @@ -221,7 +220,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se Block(List(Apply(Select(Super(This(emptyTypeName), emptyTypeName), nme.CONSTRUCTOR), Nil)), Literal(Constant(()))) ) - def moduleBody = Template(List(gen.scalaAnyRefConstr), emptyValDef, emptyInit :: definitions) + def moduleBody = Template(List(gen.scalaAnyRefConstr), noSelfType, emptyInit :: definitions) def moduleDef = ModuleDef(NoMods, newTermName(objectName), moduleBody) parser.makePackaging(0, emptyPkg, (imports :+ moduleDef).toList) } @@ -245,7 +244,7 @@ final class Eval(optionsNoncp: Seq[String], classpath: Seq[File], mkReporter: Se } override def traverse(tree: Tree): Unit = tree match { case ValDef(_, n, actualTpe, _) if isTopLevelModule(tree.symbol.owner) && isAcceptableType(actualTpe.tpe) => - vals ::= nme.localToGetter(n).encoded + vals ::= n.dropLocal.encoded case _ => super.traverse(tree) } }