diff options
18 files changed, 93 insertions, 64 deletions
diff --git a/src/actors/scala/actors/Scheduler.scala b/src/actors/scala/actors/Scheduler.scala index f6b82e1bb9..e50e848c73 100644 --- a/src/actors/scala/actors/Scheduler.scala +++ b/src/actors/scala/actors/Scheduler.scala @@ -33,7 +33,8 @@ object Scheduler extends DelegatingScheduler { /* Only <code>ForkJoinScheduler</code> implements this method. */ - @deprecated def snapshot() { + @deprecated("snapshot will be removed") + def snapshot() { if (sched.isInstanceOf[ForkJoinScheduler]) { sched.asInstanceOf[ForkJoinScheduler].snapshot() } else @@ -42,7 +43,8 @@ object Scheduler extends DelegatingScheduler { /* Only <code>ForkJoinScheduler</code> implements this method. */ - @deprecated def restart() { + @deprecated("restart will be removed") + def restart() { if (sched.isInstanceOf[ForkJoinScheduler]) { sched.asInstanceOf[ForkJoinScheduler].restart() } else diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala index 4a5afb7baf..a7be8ae13e 100644 --- a/src/compiler/scala/tools/nsc/Settings.scala +++ b/src/compiler/scala/tools/nsc/Settings.scala @@ -139,7 +139,7 @@ class Settings(errorFn: String => Unit) extends ScalacSettings { val arg :: rest = args if (arg == "") { // it looks like Ant passes "" sometimes - doArgs(rest) + rest } else if (!arg.startsWith("-")) { errorFn("Argument '" + arg + "' does not start with '-'.") @@ -158,11 +158,11 @@ class Settings(errorFn: String => Unit) extends ScalacSettings { // Internally we use Option[List[String]] to discover error, // but the outside expects our arguments back unchanged on failure if (arg contains ":") parseColonArg(arg) match { - case Some(_) => doArgs(rest) + case Some(_) => rest case None => args } else if (isPropertyArg(arg)) parsePropertyArg(arg) match { - case Some(_) => doArgs(rest) + case Some(_) => rest case None => args } else parseNormalArg(arg, rest) match { diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala index c07cb62277..cce0dc7634 100644 --- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala +++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala @@ -1,3 +1,9 @@ +/* NSC -- new Scala compiler + * Copyright 2005-2009 LAMP/EPFL + * @author Martin Odersky + */ +// $Id$ + package scala.tools.nsc package interactive @@ -87,7 +93,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana val changesOf = new mutable.HashMap[Symbol, List[Change]] val defs = compiler.dependencyAnalysis.definitions - for (val src <- files; val syms = defs(src); val sym <- syms) { + for (src <- files; val syms = defs(src); sym <- syms) { definitions(src).find(_.fullNameString == sym.fullNameString) match { case Some(oldSym) => changesOf(oldSym) = changeSet(oldSym, sym) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala index d36ca29afa..05ee731ca1 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala @@ -146,7 +146,7 @@ abstract class Pickler extends SubComponent { localChildDummy.setInfo(ClassInfoType(List(sym.tpe), EmptyScope, localChildDummy)) localChildDummy :: globals } - putChildren(sym, children.sort((x, y) => x isLess y)) + putChildren(sym, children.sortWith((x, y) => x isLess y)) } for (annot <- staticAnnotations(sym.annotations.reverse)) putAnnotation(sym, annot) diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 03526665dd..2ee768b592 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1,3 +1,9 @@ +/* NSC -- new Scala compiler + * Copyright 2005-2009 LAMP/EPFL + * @author Iulian Dragos + */ +// $Id$ + package scala.tools.nsc package transform @@ -190,8 +196,8 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val tvars = if (sym.isClass) env.keySet else specializedTypeVars(sym.info).intersect(env.keySet) val (methparams, others) = tvars.toList.partition(_.owner.isMethod) - val tvars1 = methparams.sort(_.name.toString < _.name.toString) - val tvars2 = others.sort(_.name.toString < _.name.toString) + val tvars1 = methparams.sortWith(_.name.toString < _.name.toString) + val tvars2 = others.sortWith(_.name.toString < _.name.toString) log("specName(" + sym + ") env " + env) specializedName(sym.name, tvars1 map env, tvars2 map env) } @@ -1036,8 +1042,8 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { // replace value and type paremeters of the old method with the new ones val symSubstituter = new ImplementationAdapter( - List.flatten(parameters(target)) ::: origtparams, - List.flatten(vparamss1).map(_.symbol) ::: newtparams) + parameters(target).flatten ::: origtparams, + vparamss1.flatten.map(_.symbol) ::: newtparams) val adapter = new AdaptSpecializedValues val tmp = symSubstituter(adapter(body(target).duplicate)) tpt.tpe = tpt.tpe.substSym(oldtparams, newtparams) diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala index 8de201ec9a..f319afdf2e 100644 --- a/src/library/scala/Enumeration.scala +++ b/src/library/scala/Enumeration.scala @@ -169,14 +169,16 @@ abstract class Enumeration(initial: Int, names: String*) { /** this enumeration value as an <code>Int</code> bit mask. * @throws IllegalArgumentException if <code>id</code> is greater than 31 */ - @deprecated def mask32: Int = { + @deprecated("mask32 will be removed") + def mask32: Int = { if (id >= 32) throw new IllegalArgumentException 1 << id } /** this enumeration value as an <code>Long</code> bit mask. * @throws IllegalArgumentException if <code>id</code> is greater than 63 */ - @deprecated def mask64: Long = { + @deprecated("mask64 will be removed") + def mask64: Long = { if (id >= 64) throw new IllegalArgumentException 1L << id } diff --git a/src/library/scala/collection/immutable/StringLike.scala b/src/library/scala/collection/immutable/StringLike.scala index f45acc1506..5d1b581594 100644 --- a/src/library/scala/collection/immutable/StringLike.scala +++ b/src/library/scala/collection/immutable/StringLike.scala @@ -127,7 +127,7 @@ self => else if (toString.length == 0) "" else { val chars = toString.toCharArray - chars(0) = chars(0).toUpperCase + chars(0) = chars(0).toUpper new String(chars) } diff --git a/src/scalap/scala/tools/scalap/Arguments.scala b/src/scalap/scala/tools/scalap/Arguments.scala index fb06b8d782..724032bea2 100644 --- a/src/scalap/scala/tools/scalap/Arguments.scala +++ b/src/scalap/scala/tools/scalap/Arguments.scala @@ -1,7 +1,7 @@ /* ___ ____ ___ __ ___ ___ ** / _// __// _ | / / / _ | / _ \ Scala classfile decoder -** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2006, LAMP/EPFL -** /____/\___/_/ |_/____/_/ |_/_/ +** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2009, LAMP/EPFL +** /____/\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/ ** */ @@ -49,7 +49,7 @@ object Arguments { this } - def parseBinding(str: String, separator: Char): Pair[String, String] = { + def parseBinding(str: String, separator: Char): (String, String) = { val eqls = str.indexOf(separator) if (eqls < 0) { error("missing '" + separator + "' in binding '" + str + "'") @@ -65,34 +65,34 @@ object Arguments { res } - def parse(args: Array[String], res: Arguments): Unit = { + def parse(args: Array[String], res: Arguments) { if (args != null) { - var i = 0; + var i = 0 while (i < args.length) if ((args(i) == null) || (args(i).length() == 0)) - i = i + 1 + i += 1 else if (args(i).charAt(0) != optionPrefix) { res.addOther(args(i)) - i = i + 1 + i += 1 } else if (options contains args(i)) { res.addOption(args(i)) - i = i + 1 + i += 1 } else if (optionalArgs contains args(i)) { if ((i + 1) == args.length) { error("missing argument for '" + args(i) + "'") - i = i + 1 + i += 1 } else { res.addArgument(args(i), args(i + 1)) - i = i + 2 + i += 2 } } else if (optionalBindings contains args(i)) { if ((i + 1) == args.length) { error("missing argument for '" + args(i) + "'") - i = i + 1 + i += 1 } else { res.addBinding(args(i), parseBinding(args(i + 1), optionalBindings(args(i)))); - i = i + 2 + i += 2 } } else { var iter = prefixes.iterator @@ -101,7 +101,7 @@ object Arguments { val prefix = iter.next if (args(i) startsWith prefix) { res.addPrefixed(prefix, args(i).substring(prefix.length()).trim()); - i = i + 1 + i += 1 } } if (i == j) { @@ -144,7 +144,9 @@ class Arguments { def addOption(option: String): Unit = options += option - def addArgument(option: String, arg: String): Unit = arguments(option) = arg + def addArgument(option: String, arg: String) { + arguments(option) = arg + } def addPrefixed(prefix: String, arg: String): Unit = if (prefixes isDefinedAt prefix) @@ -164,8 +166,9 @@ class Arguments { } } - def addBinding(tag: String, binding: Pair[String, String]): Unit = + def addBinding(tag: String, binding: Pair[String, String]) { addBinding(tag, binding._1, binding._2) + } def addOther(arg: String): Unit = others += arg diff --git a/src/scalap/scala/tools/scalap/ByteArrayReader.scala b/src/scalap/scala/tools/scalap/ByteArrayReader.scala index 98c6f5279f..9f9fceab26 100644 --- a/src/scalap/scala/tools/scalap/ByteArrayReader.scala +++ b/src/scalap/scala/tools/scalap/ByteArrayReader.scala @@ -1,7 +1,7 @@ /* ___ ____ ___ __ ___ ___ ** / _// __// _ | / / / _ | / _ \ Scala classfile decoder -** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2006, LAMP/EPFL -** /____/\___/_/ |_/____/_/ |_/_/ +** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2009, LAMP/EPFL +** /____/\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/ ** */ @@ -28,7 +28,7 @@ class ByteArrayReader(content: Array[Byte]) { /** read a byte */ def nextByte: Byte = { - bp = bp + 1 + bp += 1 buf(bp - 1) } @@ -37,21 +37,21 @@ class ByteArrayReader(content: Array[Byte]) { def nextBytes(len: Int): Array[Byte] = { val res = new Array[Byte](len) System.arraycopy(buf, bp, res, 0, len) - bp = bp + len + bp += len res } /** read a character */ def nextChar: Char = { - bp = bp + 2 + bp += 2 (((buf(bp - 2) & 0xff) << 8) + (buf(bp - 1) & 0xff)).asInstanceOf[Char] } /** read an integer */ def nextInt: Int = { - bp = bp + 4 + bp += 4 ((buf(bp - 4) & 0xff) << 24) + ((buf(bp - 3) & 0xff) << 16) + ((buf(bp - 2) & 0xff) << 8) + @@ -78,7 +78,7 @@ class ByteArrayReader(content: Array[Byte]) { var b: Byte = 0 do { b = buf(bp) - bp = bp + 1 + bp += 1 x = (x << 7) + (b & 0x7f) } while ((b & 0x80) != 0) x @@ -91,7 +91,7 @@ class ByteArrayReader(content: Array[Byte]) { var i: Int = 0 while (i < n) { x = (x << 8) + (nextByte & 0xff) - i = i + 1 + i += 1 } val leading: Int = 64 - (n * 8) x << leading >> leading @@ -103,21 +103,21 @@ class ByteArrayReader(content: Array[Byte]) { val cs: Array[Char] = new Array(len) var i = bp var j = 0 - bp = bp + len + bp += len while (i < bp) { var b: Int = buf(i) & 0xFF - i = i + 1 + i += 1 if (b >= 0xE0) { b = ((b & 0x0F) << 12) | (buf(i) & 0x3F) << 6 - i = i + 1 + i += 1 b = b | (buf(i) & 0x3F) - i = i + 1 + i += 1 } else if (b >= 0xC0) { b = ((b & 0x1F) << 6) | (buf(i) & 0x3F) - i = i + 1 + i += 1 } cs(j) = b.asInstanceOf[Char] - j = j + 1 + j += 1 } new String(cs, 0, j) } @@ -150,8 +150,8 @@ class ByteArrayReader(content: Array[Byte]) { /** skip next 'n' bytes */ - def skip(n: Int): Unit = { - bp = bp + n + def skip(n: Int) { + bp += n } } diff --git a/src/scalap/scala/tools/scalap/Classfiles.scala b/src/scalap/scala/tools/scalap/Classfiles.scala index 5c147f322b..e21ae76fb0 100644 --- a/src/scalap/scala/tools/scalap/Classfiles.scala +++ b/src/scalap/scala/tools/scalap/Classfiles.scala @@ -1,7 +1,7 @@ /* ___ ____ ___ __ ___ ___ ** / _// __// _ | / / / _ | / _ \ Scala classfile decoder -** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2006, LAMP/EPFL -** /____/\___/_/ |_/____/_/ |_/_/ +** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2009, LAMP/EPFL +** /____/\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/ ** */ @@ -54,3 +54,4 @@ object Classfiles { final val SCALA_N = "ScalaSignature" final val CONSTR_N = "<init>" } + diff --git a/src/scalap/scala/tools/scalap/CodeWriter.scala b/src/scalap/scala/tools/scalap/CodeWriter.scala index 9728c4c3c9..738e13b9fb 100644 --- a/src/scalap/scala/tools/scalap/CodeWriter.scala +++ b/src/scalap/scala/tools/scalap/CodeWriter.scala @@ -1,7 +1,7 @@ /* ___ ____ ___ __ ___ ___ ** / _// __// _ | / / / _ | / _ \ Scala classfile decoder -** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2006, LAMP/EPFL -** /____/\___/_/ |_/____/_/ |_/_/ +** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2009, LAMP/EPFL +** /____/\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/ ** */ @@ -43,12 +43,12 @@ class CodeWriter(writer: Writer) { } def indent: CodeWriter = { - level = level + 1 + level += 1 this } def undent: CodeWriter = { - level = level - 1 + level -= 1 this } @@ -117,7 +117,7 @@ class CodeWriter(writer: Writer) { var i = 0 while (i < level) { writer.write(step) - i = i + 1 + i += 1 } } if (space) diff --git a/src/scalap/scala/tools/scalap/JavaWriter.scala b/src/scalap/scala/tools/scalap/JavaWriter.scala index f25b2210bd..06fec1a8fb 100644 --- a/src/scalap/scala/tools/scalap/JavaWriter.scala +++ b/src/scalap/scala/tools/scalap/JavaWriter.scala @@ -1,7 +1,7 @@ /* ___ ____ ___ __ ___ ___ ** / _// __// _ | / / / _ | / _ \ Scala classfile decoder ** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2009, LAMP/EPFL -** /____/\___/_/ |_/____/_/ |_/_/ +** /____/\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/ ** */ diff --git a/src/scalap/scala/tools/scalap/Main.scala b/src/scalap/scala/tools/scalap/Main.scala index e4d215a0fd..0453bf93a7 100644 --- a/src/scalap/scala/tools/scalap/Main.scala +++ b/src/scalap/scala/tools/scalap/Main.scala @@ -31,7 +31,7 @@ object Main { /**Prints usage information for scalap. */ - def usage: Unit = { + def usage { Console.println("usage: scalap {<option>} <name>") Console.println("where <option> is") Console.println(" -private print private definitions") @@ -52,7 +52,7 @@ object Main { * * @param clazz the class file to be processed. */ - def processJavaClassFile(clazz: Classfile): Unit = { + def processJavaClassFile(clazz: Classfile) { // construct a new output stream writer val out = new OutputStreamWriter(Console.out) val writer = new JavaWriter(clazz, out) @@ -67,7 +67,7 @@ object Main { val baos = new ByteArrayOutputStream val stream = new PrintStream(baos) val syms = scalaSig.topLevelClasses ::: scalaSig.topLevelObjects - syms.first.parent match { + syms.head.parent match { //Partial match case Some(p) if (p.name != "<empty>") => { val path = p.path diff --git a/src/scalap/scala/tools/scalap/MetaParser.scala b/src/scalap/scala/tools/scalap/MetaParser.scala index 2a1e3c5c34..9313b10889 100644 --- a/src/scalap/scala/tools/scalap/MetaParser.scala +++ b/src/scalap/scala/tools/scalap/MetaParser.scala @@ -1,7 +1,7 @@ /* ___ ____ ___ __ ___ ___ ** / _// __// _ | / / / _ | / _ \ Scala classfile decoder -** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2006, LAMP/EPFL -** /____/\___/_/ |_/____/_/ |_/_/ +** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2009, LAMP/EPFL +** /____/\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/ ** */ @@ -29,7 +29,7 @@ class MetaParser(meta: String) { } protected def parseType: Unit = { - if (token.startsWith("?")) + if (token startsWith "?") res.append(token.substring(1)) else res.append(token) @@ -60,7 +60,7 @@ class MetaParser(meta: String) { else if (token == "constr") Some(parseConstrField) else - None; + None } catch { case _ => None } diff --git a/src/scalap/scala/tools/scalap/Names.scala b/src/scalap/scala/tools/scalap/Names.scala index 0a1399b37c..d0197ddd77 100644 --- a/src/scalap/scala/tools/scalap/Names.scala +++ b/src/scalap/scala/tools/scalap/Names.scala @@ -1,7 +1,7 @@ /* ___ ____ ___ __ ___ ___ ** / _// __// _ | / / / _ | / _ \ Scala classfile decoder -** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2006, LAMP/EPFL -** /____/\___/_/ |_/____/_/ |_/_/ +** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2009, LAMP/EPFL +** /____/\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/ ** */ diff --git a/src/scalap/scala/tools/scalap/Properties.scala b/src/scalap/scala/tools/scalap/Properties.scala index 2b5dec816b..9027bc3d03 100644 --- a/src/scalap/scala/tools/scalap/Properties.scala +++ b/src/scalap/scala/tools/scalap/Properties.scala @@ -1,6 +1,6 @@ /* ___ ____ ___ __ ___ ___ ** / _// __// _ | / / / _ | / _ \ Scala classfile decoder -** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2007, LAMP/EPFL +** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2009, LAMP/EPFL ** /____/\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/ ** */ diff --git a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala index 0fbea9a125..5ae6ef7c64 100644 --- a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala +++ b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala @@ -1,3 +1,12 @@ +/* ___ ____ ___ __ ___ ___ +** / _// __// _ | / / / _ | / _ \ Scala classfile decoder +** __\ \/ /__/ __ |/ /__/ __ |/ ___/ (c) 2003-2009, LAMP/EPFL +** /____/\___/_/ |_/____/_/ |_/_/ http://scala-lang.org/ +** +*/ + +// $Id$ + package scala.tools.scalap package scalax package rules diff --git a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala index b80d60572f..abff45fca5 100644 --- a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala +++ b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala @@ -220,7 +220,7 @@ class ScalaSigPrinter(stream: PrintStream, printPrivates: Boolean) { indent() printModifiers(m) if (m.isAccessor) { - val indexOfSetter = m.parent.get.children.findIndexOf(x => x.isInstanceOf[MethodSymbol] && + val indexOfSetter = m.parent.get.children.indexWhere(x => x.isInstanceOf[MethodSymbol] && x.asInstanceOf[MethodSymbol].name == n + "_$eq") print(if (indexOfSetter > 0) "var " else "val ") } else { |