From 6e061d6f2597a3e4bdc7fcf192abbdb419917b70 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 22 Feb 2010 00:16:03 +0000 Subject: Some deprecation patrol and minor cleanups. --- src/actors/scala/actors/Reaction.scala | 2 +- .../scala/tools/nsc/interactive/RefinedBuildManager.scala | 6 +++--- src/partest/scala/tools/partest/nest/DirectRunner.scala | 8 ++++---- src/partest/scala/tools/partest/nest/FileManager.scala | 9 ++------- src/partest/scala/tools/partest/nest/Worker.scala | 2 +- test/files/pos/bug432.scala | 2 +- test/files/run/iterators.scala | 4 ++-- test/files/run/lists.scala | 4 ++-- tools/truncate | 7 +++++++ truncate | 7 ------- 10 files changed, 23 insertions(+), 28 deletions(-) create mode 100755 tools/truncate delete mode 100755 truncate diff --git a/src/actors/scala/actors/Reaction.scala b/src/actors/scala/actors/Reaction.scala index 65584880f7..a8364bc8fb 100644 --- a/src/actors/scala/actors/Reaction.scala +++ b/src/actors/scala/actors/Reaction.scala @@ -25,7 +25,7 @@ private[actors] class KillActorException extends Throwable with ControlException * * @author Philipp Haller */ -@deprecated +@deprecated("This class will be removed in a future release") class Reaction(a: Actor, f: PartialFunction[Any, Any], msg: Any) extends ActorTask(a, () => { if (f == null) a.act() diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala index 8f11d26b8a..bcc58ec448 100644 --- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala @@ -111,9 +111,9 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana (from.hasFlag(Flags.MODULE) == to.hasFlag(Flags.MODULE)) // For testing purposes only, order irrelevant for compilation - def toStringSet(set: Set[AbstractFile]): String = { - val s = (set.toList).sort(_.name < _.name) - s.mkString("Set(", ", ", ")") + def toStringSet(set: Set[AbstractFile]): String = { + val s = set.toList sortBy (_.name) + s.mkString("Set(", ", ", ")") } def update0(files: Set[AbstractFile]): Unit = if (!files.isEmpty) { diff --git a/src/partest/scala/tools/partest/nest/DirectRunner.scala b/src/partest/scala/tools/partest/nest/DirectRunner.scala index 0853a9a84b..3778a927df 100644 --- a/src/partest/scala/tools/partest/nest/DirectRunner.scala +++ b/src/partest/scala/tools/partest/nest/DirectRunner.scala @@ -57,13 +57,13 @@ trait DirectRunner { workers foreach { w => receiveWithin(3600 * 1000) { case Results(res, logs, outdirs) => - logsToDelete = logsToDelete ::: logs.filter(_.toDelete) - outdirsToDelete = outdirsToDelete ::: outdirs - results = results ++ res + logsToDelete :::= logs filter (_.toDelete) + outdirsToDelete :::= outdirs + results ++= res case TIMEOUT => // add at least one failure NestUI.verbose("worker timed out; adding failed test") - results = results + ("worker timed out; adding failed test" -> 2) + results += ("worker timed out; adding failed test" -> 2) } } if (!isPartestDebug) { diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala index df7a8e129c..ffeba6bbe3 100644 --- a/src/partest/scala/tools/partest/nest/FileManager.scala +++ b/src/partest/scala/tools/partest/nest/FileManager.scala @@ -12,16 +12,11 @@ import java.io.{File, FilenameFilter, IOException, StringWriter, FileInputStream, FileOutputStream, BufferedReader, FileReader, PrintWriter, FileWriter} import java.net.URI -import scala.tools.nsc.io.Directory +import scala.tools.nsc.io.{ Path, Directory } trait FileManager { - def basename(name: String): String = { - val inx = name.lastIndexOf(".") - if (inx < 0) name else name.substring(0, inx) - } - - def deleteRecursive(dir: File) { Directory(dir).deleteRecursively() } + def basename(name: String): String = Path(name).stripExtension /** * Compares two files using a Java implementation of the GNU diff diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index 9d990ef1ac..7a947b3298 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -973,7 +973,7 @@ class Worker(val fileManager: FileManager) extends Actor { try { // delete log file only if test was successful - if (good && !logFile.isEmpty) + if (good && !logFile.isEmpty && !isPartestDebug) logFile.get.toDelete = true writers match { diff --git a/test/files/pos/bug432.scala b/test/files/pos/bug432.scala index 8e3097ac9d..087fd70aba 100644 --- a/test/files/pos/bug432.scala +++ b/test/files/pos/bug432.scala @@ -1,2 +1,2 @@ -case class Tata +case class Tata() object Tata diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala index 5879d38df3..b7dc16237a 100644 --- a/test/files/run/iterators.scala +++ b/test/files/run/iterators.scala @@ -93,8 +93,8 @@ object Test { } def check_findIndexOf: String = { - val i = List(1, 2, 3, 4, 5).findIndexOf { x: Int => x >= 4 } - val j = List(1, 2, 3, 4, 5).findIndexOf { x: Int => x >= 16 } + val i = List(1, 2, 3, 4, 5).indexWhere { x: Int => x >= 4 } + val j = List(1, 2, 3, 4, 5).indexWhere { x: Int => x >= 16 } "" + i + "x" + j } diff --git a/test/files/run/lists.scala b/test/files/run/lists.scala index 695d5a0336..6c9b55961e 100644 --- a/test/files/run/lists.scala +++ b/test/files/run/lists.scala @@ -126,8 +126,8 @@ object Test1 extends TestCase("ctor") with Assert { assertEquals("check_forall", true, b1 & b2) } { - val ys1 = xs1 remove { e => e % 2 != 0 } - val ys2 = xs4 remove { e => e < 5 } + val ys1 = xs1 filterNot { e => e % 2 != 0 } + val ys2 = xs4 filterNot { e => e < 5 } assertEquals("check_remove", 3, ys1.length + ys2.length) } { diff --git a/tools/truncate b/tools/truncate new file mode 100755 index 0000000000..b7f410e25d --- /dev/null +++ b/tools/truncate @@ -0,0 +1,7 @@ +#!/bin/bash + +find . -type f -not -path "*.svn*" -name "*.scala" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; +find . -type f -not -path "*.svn*" -name "*.java" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; +find . -type f -not -path "*.svn*" -name "*.cs" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; +find . -type f -not -path "*.svn*" -name "*.js" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; +find . -type f -not -path "*.svn*" -name "*.scala.disabled" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; diff --git a/truncate b/truncate deleted file mode 100755 index b7f410e25d..0000000000 --- a/truncate +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -find . -type f -not -path "*.svn*" -name "*.scala" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; -find . -type f -not -path "*.svn*" -name "*.java" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; -find . -type f -not -path "*.svn*" -name "*.cs" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; -find . -type f -not -path "*.svn*" -name "*.js" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; -find . -type f -not -path "*.svn*" -name "*.scala.disabled" -exec sed -i "" -e 's/$ *Id.*$/$Id$/g' {} \; -- cgit v1.2.3