diff options
author | Paul Phillips <paulp@improving.org> | 2011-12-08 15:31:07 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-12-08 15:31:07 -0800 |
commit | a8da940cb62d7a57ef4d405a176223c02479c779 (patch) | |
tree | ee59f60a956f52e102b69009f1bda03e61937aaa /src | |
parent | 4da259b26eb9d3409392fef91d36471cd7ac4354 (diff) | |
parent | 6a16e1a4fc08fd47b19c32c19106e6405160e1c4 (diff) | |
download | scala-a8da940cb62d7a57ef4d405a176223c02479c779.tar.gz scala-a8da940cb62d7a57ef4d405a176223c02479c779.tar.bz2 scala-a8da940cb62d7a57ef4d405a176223c02479c779.zip |
Merge remote-tracking branches 'VladUreche/issue/5054' and 'jsuereth/dont_resolve_releases'
Diffstat (limited to 'src')
41 files changed, 155 insertions, 189 deletions
diff --git a/src/actors/scala/actors/ActorTask.scala b/src/actors/scala/actors/ActorTask.scala index 8d0379c095..090d0448f0 100644 --- a/src/actors/scala/actors/ActorTask.scala +++ b/src/actors/scala/actors/ActorTask.scala @@ -12,12 +12,16 @@ package scala.actors /** * @author Philipp Haller + * @note This class inherits a public var called 'msg' from ReactorTask, + * and also defines a constructor parameter which shadows it (which makes any + * changes to the underlying var invisible.) I can't figure out what's supposed + * to happen, so I renamed the constructor parameter to at least be less confusing. */ private[actors] class ActorTask(actor: Actor, fun: () => Unit, handler: PartialFunction[Any, Any], - msg: Any) - extends ReplyReactorTask(actor, fun, handler, msg) { + initialMsg: Any) + extends ReplyReactorTask(actor, fun, handler, initialMsg) { protected override def beginExecution() { super.beginExecution() @@ -31,8 +35,11 @@ private[actors] class ActorTask(actor: Actor, val senderInfo = try { Some(actor.sender) } catch { case _: Exception => None } + // !!! If this is supposed to be setting the current contents of the + // inherited mutable var rather than always the value given in the constructor, + // then it should be changed from initialMsg to msg. val uncaught = UncaughtException(actor, - if (msg != null) Some(msg) else None, + if (initialMsg != null) Some(initialMsg) else None, senderInfo, Thread.currentThread, e) diff --git a/src/actors/scala/actors/ReplyReactorTask.scala b/src/actors/scala/actors/ReplyReactorTask.scala index 1db722f89b..cb63d7e000 100644 --- a/src/actors/scala/actors/ReplyReactorTask.scala +++ b/src/actors/scala/actors/ReplyReactorTask.scala @@ -12,18 +12,25 @@ package scala.actors /** * @author Philipp Haller + * @note This class inherits a public var called 'reactor' from ReactorTask, + * and also defines a constructor parameter which shadows it (which makes any + * changes to the underlying var invisible.) I can't figure out what's supposed + * to happen, so I renamed the constructor parameter to at least be less confusing. */ -private[actors] class ReplyReactorTask(reactor: ReplyReactor, +private[actors] class ReplyReactorTask(replyReactor: ReplyReactor, fun: () => Unit, handler: PartialFunction[Any, Any], msg: Any) - extends ReactorTask(reactor, fun, handler, msg) { + extends ReactorTask(replyReactor, fun, handler, msg) { var saved: ReplyReactor = _ protected override def beginExecution() { saved = Actor.tl.get - Actor.tl set reactor + // !!! If this is supposed to be setting the current contents of the + // inherited mutable var rather than always the value given in the constructor, + // then it should be changed to "set reactor". + Actor.tl set replyReactor } protected override def suspendExecution() { diff --git a/src/compiler/scala/reflect/internal/Symbols.scala b/src/compiler/scala/reflect/internal/Symbols.scala index a59ea2c1bf..75fd733e7e 100644 --- a/src/compiler/scala/reflect/internal/Symbols.scala +++ b/src/compiler/scala/reflect/internal/Symbols.scala @@ -494,8 +494,8 @@ trait Symbols extends api.Symbols { self: SymbolTable => // string. So this needs attention. For now the fact that migration is // private[scala] ought to provide enough protection. def hasMigrationAnnotation = hasAnnotation(MigrationAnnotationClass) - def migrationMessage = getAnnotation(MigrationAnnotationClass) flatMap { _.stringArg(2) } - def migrationVersion = getAnnotation(MigrationAnnotationClass) map { version => version.intArg(0).get + "." + version.intArg(1).get } + def migrationMessage = getAnnotation(MigrationAnnotationClass) flatMap { _.stringArg(0) } + def migrationVersion = getAnnotation(MigrationAnnotationClass) flatMap { _.stringArg(1) } def elisionLevel = getAnnotation(ElidableMethodClass) flatMap { _.intArg(0) } def implicitNotFoundMsg = getAnnotation(ImplicitNotFoundClass) flatMap { _.stringArg(0) } diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala index 265261f594..d17747e22a 100644 --- a/src/compiler/scala/reflect/internal/Types.scala +++ b/src/compiler/scala/reflect/internal/Types.scala @@ -649,7 +649,11 @@ trait Types extends api.Types { self: SymbolTable => } /** Returns all parts of this type which satisfy predicate `p` */ - def filter(p: Type => Boolean): List[Type] = new FilterTypeCollector(p).collect(this).toList + def filter(p: Type => Boolean): List[Type] = new FilterTypeCollector(p) collect this + def withFilter(p: Type => Boolean) = new FilterTypeCollector(p) { + def foreach[U](f: Type => U): Unit = collect(Type.this) foreach f + def map[T](f: Type => T): List[T] = collect(Type.this) map f + } /** Returns optionally first type (in a preorder traversal) which satisfies predicate `p`, * or None if none exists. @@ -4094,9 +4098,13 @@ A type's typeSymbol should never be inspected directly. } /** A map to implement the `filter` method. */ - class FilterTypeCollector(p: Type => Boolean) extends TypeCollector(new ListBuffer[Type]) { + class FilterTypeCollector(p: Type => Boolean) extends TypeCollector[List[Type]](Nil) { + def withFilter(q: Type => Boolean) = new FilterTypeCollector(tp => p(tp) && q(tp)) + + override def collect(tp: Type) = super.collect(tp).reverse + def traverse(tp: Type) { - if (p(tp)) result += tp + if (p(tp)) result ::= tp mapOver(tp) } } diff --git a/src/compiler/scala/reflect/internal/pickling/UnPickler.scala b/src/compiler/scala/reflect/internal/pickling/UnPickler.scala index 9aa3d8a2c3..1a8540c158 100644 --- a/src/compiler/scala/reflect/internal/pickling/UnPickler.scala +++ b/src/compiler/scala/reflect/internal/pickling/UnPickler.scala @@ -46,7 +46,7 @@ abstract class UnPickler /*extends reflect.generic.UnPickler*/ { } } - class Scan(bytes: Array[Byte], offset: Int, classRoot: Symbol, moduleRoot: Symbol, filename: String) extends PickleBuffer(bytes, offset, -1) { + class Scan(_bytes: Array[Byte], offset: Int, classRoot: Symbol, moduleRoot: Symbol, filename: String) extends PickleBuffer(_bytes, offset, -1) { //println("unpickle " + classRoot + " and " + moduleRoot)//debug protected def debug = settings.debug.value diff --git a/src/compiler/scala/reflect/runtime/ToolBoxes.scala b/src/compiler/scala/reflect/runtime/ToolBoxes.scala index e617239398..03947574db 100644 --- a/src/compiler/scala/reflect/runtime/ToolBoxes.scala +++ b/src/compiler/scala/reflect/runtime/ToolBoxes.scala @@ -42,11 +42,10 @@ trait ToolBoxes extends { self: Universe => def wrapInObject(expr: Tree, fvs: List[Symbol]): ModuleDef = { val obj = EmptyPackageClass.newModule(NoPosition, nextWrapperModuleName()) - val minfo = ClassInfoType(List(ObjectClass.tpe), new Scope, obj.moduleClass) + val minfo = ClassInfoType(List(ObjectClass.tpe, ScalaObjectClass.tpe), new Scope, obj.moduleClass) obj.moduleClass setInfo minfo obj setInfo obj.moduleClass.tpe val meth = obj.moduleClass.newMethod(NoPosition, wrapperMethodName) - meth setFlag Flags.STATIC def makeParam(fv: Symbol) = meth.newValueParameter(NoPosition, fv.name) setInfo fv.tpe meth setInfo MethodType(fvs map makeParam, expr.tpe) minfo.decls enter meth @@ -88,11 +87,19 @@ trait ToolBoxes extends { self: Universe => def runExpr(expr: Tree): Any = { val etpe = expr.tpe val fvs = (expr filter isFree map (_.symbol)).distinct + + reporter.reset() val className = compileExpr(expr, fvs) + if (reporter.hasErrors) { + throw new Error("reflective compilation has failed") + } + if (settings.debug.value) println("generated: "+className) val jclazz = jClass.forName(moduleFileName(className), true, classLoader) val jmeth = jclazz.getDeclaredMethods.find(_.getName == wrapperMethodName).get - val result = jmeth.invoke(null, fvs map (sym => sym.asInstanceOf[FreeVar].value.asInstanceOf[AnyRef]): _*) + val jfield = jclazz.getDeclaredFields.find(_.getName == NameTransformer.MODULE_INSTANCE_NAME).get + val singleton = jfield.get(null) + val result = jmeth.invoke(singleton, fvs map (sym => sym.asInstanceOf[FreeVar].value.asInstanceOf[AnyRef]): _*) if (etpe.typeSymbol != FunctionClass(0)) result else { val applyMeth = result.getClass.getMethod("apply") diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 7fea76c7b1..f900859f46 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -22,8 +22,8 @@ import symtab.Flags.{ACCESSOR, PARAMACCESSOR} /** The main class of the presentation compiler in an interactive environment such as an IDE */ -class Global(settings: Settings, reporter: Reporter, projectName: String = "") - extends scala.tools.nsc.Global(settings, reporter) +class Global(settings: Settings, _reporter: Reporter, projectName: String = "") + extends scala.tools.nsc.Global(settings, _reporter) with CompilerControl with RangePositions with ContextTrees diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index d001a0af8b..98345dd01e 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -297,7 +297,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL { case nme.toDouble => "toDouble" case _ => return None } - Some(newName, runtimeTest) + Some((newName, runtimeTest)) } def infixTest(name: Name): Option[(String, Tree => Tree)] = { val (newName, runtimeTest) = name match { @@ -322,7 +322,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL { case nme.ZAND => ("takeConditionalAnd", testForBoolean) case _ => return None } - Some(newName, runtimeTest) + Some((newName, runtimeTest)) } /** The Tree => Tree function in the return is necessary to prevent the original qual diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 9806857ff2..1a421eb82f 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -421,7 +421,7 @@ abstract class Erasure extends AddInterfaces */ /** The modifier typer which retypes with erased types. */ - class Eraser(context: Context) extends Typer(context) { + class Eraser(_context: Context) extends Typer(_context) { private def safeToRemoveUnbox(cls: Symbol): Boolean = (cls == definitions.NullClass) || isBoxedValueClass(cls) diff --git a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala index 031be21f24..2bed5bffd4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala @@ -69,7 +69,7 @@ abstract class Duplicators extends Analyzer { * tree, except for TypeTrees, are erased prior to type checking. TypeTrees * are fixed by substituting invalid symbols for the new ones. */ - class BodyDuplicator(context: Context) extends Typer(context: Context) { + class BodyDuplicator(_context: Context) extends Typer(_context) { class FixInvalidSyms extends TypeMap { diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 79db9ab000..5b38ddd092 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1311,7 +1311,11 @@ trait Infer { case TypeRef(_, sym, _) if isLocalBinding(sym) => ; case _ => - patternWarning(arg, "non variable type-argument ") + // Want to warn about type arguments, not type parameters. Otherwise we'll + // see warnings about "invisible" types, like: val List(x0) = x1 leading to "non + // variable type-argument A in type pattern List[A]..." + if (!arg.typeSymbol.isTypeParameterOrSkolem) + patternWarning(arg, "non variable type-argument ") } } } diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 0f57285480..364e887939 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -422,7 +422,7 @@ trait Namers extends MethodSynthesis { * @return the companion object symbol. */ def ensureCompanionObject(cdef: ClassDef, creator: ClassDef => Tree = companionModuleDef(_)): Symbol = { - val m = companionModuleOf(cdef.symbol, context) + val m = companionSymbolOf(cdef.symbol, context) // @luc: not sure why "currentRun.compiles(m)" is needed, things breaks // otherwise. documentation welcome. // @@ -855,7 +855,7 @@ trait Namers extends MethodSynthesis { // @check: this seems to work only if the type completer of the class runs before the one of the // module class: the one from the module class removes the entry from classOfModuleClass (see above). if (clazz.isClass && !clazz.hasModuleFlag) { - val modClass = companionModuleOf(clazz, context).moduleClass + val modClass = companionSymbolOf(clazz, context).moduleClass Namers.this.classOfModuleClass get modClass map { cdefRef => val cdef = cdefRef() @@ -1082,7 +1082,7 @@ trait Namers extends MethodSynthesis { val parentNamer = if (isConstr) { val (cdef, nmr) = moduleNamer.getOrElse { - val module = companionModuleOf(clazz, context) + val module = companionSymbolOf(clazz, context) module.initialize // call type completer (typedTemplate), adds the // module's templateNamer to classAndNamerOfModule classAndNamerOfModule get module match { diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala index e4ebe13217..8611fafe52 100644 --- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala +++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala @@ -189,7 +189,7 @@ trait NamesDefaults { self: Analyzer => if (pre == NoType) { None } else { - val module = companionModuleOf(baseFun.symbol.owner, context) + val module = companionSymbolOf(baseFun.symbol.owner, context) if (module == NoSymbol) None else { val ref = atPos(pos.focus)(gen.mkAttributedRef(pre, module)) @@ -414,7 +414,7 @@ trait NamesDefaults { self: Analyzer => if (i > 0) { val defGetterName = nme.defaultGetterName(param.owner.name, i) if (param.owner.isConstructor) { - val mod = companionModuleOf(param.owner.owner, context) + val mod = companionSymbolOf(param.owner.owner, context) mod.info.member(defGetterName) } else { diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 645d3ecfa0..98f1c96cad 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1273,8 +1273,10 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R * indicating it has changed semantics between versions. */ private def checkMigration(sym: Symbol, pos: Position) = { - for (msg <- sym.migrationMessage) - unit.warning(pos, sym.fullLocationString + " has changed semantics:\n" + msg) + if (sym.hasMigrationAnnotation) + unit.warning(pos, "%s has changed semantics in version %s:\n%s".format( + sym.fullLocationString, sym.migrationVersion.get, sym.migrationMessage.get) + ) } private def lessAccessible(otherSym: Symbol, memberSym: Symbol): Boolean = ( diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 7671ccbed7..9b03d59216 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1361,7 +1361,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { "you want, you must write the annotation class in Java.") if (!isPastTyper) { for (ann <- clazz.getAnnotation(DeprecatedAttr)) { - val m = companionModuleOf(clazz, context) + val m = companionSymbolOf(clazz, context) if (m != NoSymbol) m.moduleClass.addAnnotation(AnnotationInfo(ann.atp, ann.args, List())) } @@ -1377,7 +1377,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { def typedModuleDef(mdef: ModuleDef): Tree = { // initialize all constructors of the linked class: the type completer (Namer.methodSig) // might add default getters to this object. example: "object T; class T(x: Int = 1)" - val linkedClass = companionClassOf(mdef.symbol, context) + val linkedClass = companionSymbolOf(mdef.symbol, context) if (linkedClass != NoSymbol) linkedClass.info.decl(nme.CONSTRUCTOR).alternatives foreach (_.initialize) @@ -2223,7 +2223,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { (methCtx != NoContext) && { val contextFun = methCtx.tree.symbol contextFun.isPrimaryConstructor && contextFun.owner.isModuleClass && - companionModuleOf(calledFun.owner, context).moduleClass == contextFun.owner + companionSymbolOf(calledFun.owner, context).moduleClass == contextFun.owner } } } diff --git a/src/compiler/scala/tools/util/EditDistance.scala b/src/compiler/scala/tools/util/EditDistance.scala index a8d7408532..b705a1eac4 100644 --- a/src/compiler/scala/tools/util/EditDistance.scala +++ b/src/compiler/scala/tools/util/EditDistance.scala @@ -33,7 +33,7 @@ object EditDistance { 0 to n foreach (x => d(x)(0) = x) 0 to m foreach (x => d(0)(x) = x) - for (i <- 1 to n ; val s_i = s(i - 1) ; j <- 1 to m) { + for (i <- 1 to n ; s_i = s(i - 1) ; j <- 1 to m) { val t_j = t(j - 1) val cost = if (s_i == t_j) 0 else 1 diff --git a/src/library/scala/Either.scala b/src/library/scala/Either.scala index bc75f0f088..e454cdf5ec 100644 --- a/src/library/scala/Either.scala +++ b/src/library/scala/Either.scala @@ -575,15 +575,15 @@ object Either { } } - /** If the condition is satisfied, return the given `A` in `Left`, - * otherwise, return the given `B` in `Right`. + /** If the condition is satisfied, return the given `B` in `Right`, + * otherwise, return the given `A` in `Left`. * * {{{ * val userInput: String = ... * Either.cond( * userInput.forall(_.isDigit) && userInput.size == 10, - * "The input (%s) does not look like a phone number".format(userInput), - * PhoneNumber(userInput) + * PhoneNumber(userInput), + * "The input (%s) does not look like a phone number".format(userInput) * }}} */ def cond[A, B](test: Boolean, right: => B, left: => A): Either[A, B] = diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala index c967a48abc..3d85f2f52f 100644 --- a/src/library/scala/Enumeration.scala +++ b/src/library/scala/Enumeration.scala @@ -48,19 +48,20 @@ import java.util.regex.Pattern * * @param initial The initial value from which to count the integers that * identifies values at run-time. - * @param names The sequence of names to give to this enumeration's values. - * * @author Matthias Zenger */ @SerialVersionUID(8476000850333817230L) -abstract class Enumeration(initial: Int, - @deprecated("Names should be specified individually or discovered via reflection", "2.10") - names: String*) extends Serializable { +abstract class Enumeration (initial: Int) extends Serializable { thisenum => def this() = this(0) - - @deprecated("Names should be specified individually or discovered via reflection", "2.10") + + @deprecated("Names should be specified individually or discovered via reflection", "2.10.0") + def this(initial: Int, names: String*) = { + this(initial) + this.nextName = names.iterator + } + @deprecated("Names should be specified individually or discovered via reflection", "2.10.0") def this(names: String*) = this(0, names: _*) /* Note that `readResolve` cannot be private, since otherwise @@ -97,12 +98,13 @@ abstract class Enumeration(initial: Int, } /** The integer to use to identify the next created value. */ - protected var nextId = initial + protected var nextId: Int = initial /** The string to use to name the next created value. */ - protected var nextName = names.iterator + protected var nextName: Iterator[String] = _ + private def nextNameOrNull = - if (nextName.hasNext) nextName.next else null + if (nextName != null && nextName.hasNext) nextName.next else null /** The highest integer amongst those used to identify values in this * enumeration. */ @@ -120,17 +122,8 @@ abstract class Enumeration(initial: Int, */ final def apply(x: Int): Value = vmap(x) - /** - * Return a `Value` from this `Enumeration` whose name matches - * the argument `s`. - * - * You can pass a String* set of names to the constructor, or initialize - * each `Enumeration` with `Value(String)`. Otherwise, the names are - * determined automatically through reflection. - * - * Note the change here wrt 2.7 is intentional. You should know whether - * a name is in an `Enumeration` beforehand. If not, just use find on - * values. + /** Return a `Value` from this `Enumeration` whose name matches + * the argument `s`. The names are determined automatically via reflection. * * @param s an `Enumeration` name * @return the `Value` of this `Enumeration` if its name matches `s` diff --git a/src/library/scala/annotation/migration.scala b/src/library/scala/annotation/migration.scala index c2e392b807..8ab12a7c8e 100644 --- a/src/library/scala/annotation/migration.scala +++ b/src/library/scala/annotation/migration.scala @@ -14,15 +14,17 @@ package scala.annotation * reason or another retain the same name and type signature, * but some aspect of their behavior is different. An illustrative * examples is Stack.iterator, which reversed from LIFO to FIFO - * order between scala 2.7 and 2.8. + * order between Scala 2.7 and 2.8. * - * The version numbers are to mark the scala major/minor release - * version where the change took place. + * @param message A message describing the change, which is emitted + * by the compiler if the flag `-Xmigration` is set. + * + * @param changedIn The version, in which the behaviour change was + * introduced. * * @since 2.8 */ -private[scala] final class migration( - majorVersion: Int, - minorVersion: Int, - message: String) -extends annotation.StaticAnnotation {} + private[scala] final class migration(message: String, changedIn: String) extends annotation.StaticAnnotation { + @deprecated("Use the constructor taking two Strings instead.", "2.10") + def this(majorVersion: Int, minorVersion: Int, message: String) = this(message, majorVersion + "." + minorVersion) + }
\ No newline at end of file diff --git a/src/library/scala/collection/GenTraversableLike.scala b/src/library/scala/collection/GenTraversableLike.scala index dc89bcf85d..122eec2d90 100644 --- a/src/library/scala/collection/GenTraversableLike.scala +++ b/src/library/scala/collection/GenTraversableLike.scala @@ -123,10 +123,7 @@ trait GenTraversableLike[+A, +Repr] extends GenTraversableOnce[A] with Paralleli * @param bf $bfinfo * @return collection with intermediate results */ - @migration(2, 9, - "This scanRight definition has changed in 2.9.\n" + - "The previous behavior can be reproduced with scanRight.reverse." - ) + @migration("The behavior of `scanRight` has changed. The previous behavior can be reproduced with scanRight.reverse.", "2.9.0") def scanRight[B, That](z: B)(op: (A, B) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That /** Applies a function `f` to all elements of this $coll. diff --git a/src/library/scala/collection/GenTraversableViewLike.scala b/src/library/scala/collection/GenTraversableViewLike.scala index 9f7bbadfb2..78e0773fb0 100644 --- a/src/library/scala/collection/GenTraversableViewLike.scala +++ b/src/library/scala/collection/GenTraversableViewLike.scala @@ -12,8 +12,6 @@ package scala.collection import generic._ import mutable.{ Builder, ArrayBuffer } import TraversableView.NoBuilder -import annotation.migration - trait GenTraversableViewLike[+A, diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala index 7b780ba2e4..d46d215e0c 100644 --- a/src/library/scala/collection/Iterator.scala +++ b/src/library/scala/collection/Iterator.scala @@ -9,7 +9,7 @@ package scala.collection import mutable.ArrayBuffer -import annotation.{ tailrec, migration } +import annotation.migration import immutable.Stream /** The `Iterator` object provides various functions for creating specialized iterators. @@ -52,7 +52,7 @@ object Iterator { /** Creates iterator that produces the results of some element computation a number of times. * - * @param n the number of elements returned by the iterator. + * @param len the number of elements returned by the iterator. * @param elem the element computation * @return An iterator that produces the results of `n` evaluations of `elem`. */ @@ -66,7 +66,7 @@ object Iterator { /** Creates an iterator producing the values of a given function over a range of integer values starting from 0. * - * @param n The number of elements returned by the iterator + * @param end The number of elements returned by the iterator * @param f The function computing element values * @return An iterator that produces the values `f(0), ..., f(n -1)`. */ @@ -410,10 +410,7 @@ trait Iterator[+A] extends TraversableOnce[A] { * which `pf` is defined the image `pf(x)`. * @note Reuse: $consumesAndProducesIterator */ - @migration(2, 8, - "This collect implementation bears no relationship to the one before 2.8.\n"+ - "The previous behavior can be reproduced with toSeq." - ) + @migration("`collect` has changed. The previous behavior can be reproduced with `toSeq`.", "2.8.0") def collect[B](pf: PartialFunction[A, B]): Iterator[B] = { val self = buffered new AbstractIterator[B] { @@ -1033,9 +1030,9 @@ trait Iterator[+A] extends TraversableOnce[A] { /** Returns this iterator with patched values. * - * @param from The start index from which to patch - * @param ps The iterator of patch values - * @param replaced The number of values in the original iterator that are replaced by the patch. + * @param from The start index from which to patch + * @param patchElems The iterator of patch values + * @param replaced The number of values in the original iterator that are replaced by the patch. * @note Reuse: $consumesTwoAndProducesOneIterator */ def patch[B >: A](from: Int, patchElems: Iterator[B], replaced: Int): Iterator[B] = new AbstractIterator[B] { diff --git a/src/library/scala/collection/MapLike.scala b/src/library/scala/collection/MapLike.scala index 1653a011d6..07116e99dd 100644 --- a/src/library/scala/collection/MapLike.scala +++ b/src/library/scala/collection/MapLike.scala @@ -182,14 +182,14 @@ self => * * @return the keys of this map as an iterable. */ - @migration(2, 8, "As of 2.8, keys returns Iterable[A] rather than Iterator[A].") + @migration("`keys` returns `Iterable[A]` rather than `Iterator[A]`.", "2.8.0") def keys: Iterable[A] = keySet /** Collects all values of this map in an iterable collection. * * @return the values of this map as an iterable. */ - @migration(2, 8, "As of 2.8, values returns Iterable[B] rather than Iterator[B].") + @migration("`values` returns `Iterable[B]` rather than `Iterator[B]`.", "2.8.0") def values: Iterable[B] = new DefaultValuesIterable /** The implementation class of the iterable returned by `values`. diff --git a/src/library/scala/collection/SetLike.scala b/src/library/scala/collection/SetLike.scala index b4695363de..7293f3775c 100644 --- a/src/library/scala/collection/SetLike.scala +++ b/src/library/scala/collection/SetLike.scala @@ -89,7 +89,7 @@ self => // note: this is only overridden here to add the migration annotation, // which I hope to turn into an Xlint style warning as the migration aspect // is not central to its importance. - @migration(2, 8, "Set.map now returns a Set, so it will discard duplicate values.") + @migration("Set.map now returns a Set, so it will discard duplicate values.", "2.8.0") override def map[B, That](f: A => B)(implicit bf: CanBuildFrom[This, B, That]): That = super.map(f)(bf) /** Tests if some element is contained in this set. diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala index 4f0fec1de3..e2acc0b3e0 100644 --- a/src/library/scala/collection/TraversableLike.scala +++ b/src/library/scala/collection/TraversableLike.scala @@ -390,10 +390,7 @@ trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] b.result } - @migration(2, 9, - "This scanRight definition has changed in 2.9.\n" + - "The previous behavior can be reproduced with scanRight.reverse." - ) + @migration("The behavior of `scanRight` has changed. The previous behavior can be reproduced with scanRight.reverse.", "2.9.0") def scanRight[B, That](z: B)(op: (A, B) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = { var scanned = List(z) var acc = z diff --git a/src/library/scala/collection/TraversableViewLike.scala b/src/library/scala/collection/TraversableViewLike.scala index 8c67d841bc..60870cc835 100644 --- a/src/library/scala/collection/TraversableViewLike.scala +++ b/src/library/scala/collection/TraversableViewLike.scala @@ -185,10 +185,7 @@ trait TraversableViewLike[+A, override def scanLeft[B, That](z: B)(op: (B, A) => B)(implicit bf: CanBuildFrom[This, B, That]): That = newForced(thisSeq.scanLeft(z)(op)).asInstanceOf[That] - @migration(2, 9, - "This scanRight definition has changed in 2.9.\n" + - "The previous behavior can be reproduced with scanRight.reverse." - ) + @migration("The behavior of `scanRight` has changed. The previous behavior can be reproduced with scanRight.reverse.", "2.9.0") override def scanRight[B, That](z: B)(op: (A, B) => B)(implicit bf: CanBuildFrom[This, B, That]): That = newForced(thisSeq.scanRight(z)(op)).asInstanceOf[That] diff --git a/src/library/scala/collection/generic/GenericTraversableTemplate.scala b/src/library/scala/collection/generic/GenericTraversableTemplate.scala index 10cd3b5755..12c1a75c7a 100644 --- a/src/library/scala/collection/generic/GenericTraversableTemplate.scala +++ b/src/library/scala/collection/generic/GenericTraversableTemplate.scala @@ -13,7 +13,6 @@ package generic import mutable.Builder import annotation.migration -import annotation.bridge import annotation.unchecked.uncheckedVariance /** A template class for companion objects of ``regular`` collection classes @@ -148,7 +147,7 @@ trait GenericTraversableTemplate[+A, +CC[X] <: GenTraversable[X]] extends HasNew * @throws `IllegalArgumentException` if all collections in this $coll * are not of the same size. */ - @migration(2, 9, "As of 2.9, transpose throws an exception if collections are not uniformly sized.") + @migration("`transpose` throws an `IllegalArgumentException` if collections are not uniformly sized.", "2.9.0") def transpose[B](implicit asTraversable: A => /*<:<!!!*/ GenTraversableOnce[B]): CC[CC[B] @uncheckedVariance] = { if (isEmpty) return genericBuilder[CC[B]].result diff --git a/src/library/scala/collection/mutable/BufferLike.scala b/src/library/scala/collection/mutable/BufferLike.scala index acf26e59eb..1dc2fc27d5 100644 --- a/src/library/scala/collection/mutable/BufferLike.scala +++ b/src/library/scala/collection/mutable/BufferLike.scala @@ -152,7 +152,7 @@ trait BufferLike[A, +This <: BufferLike[A, This] with Buffer[A]] def prepend(elems: A*) { prependAll(elems) } /** Prepends the elements contained in a traversable object to this buffer. - * @param elems the collection containing the elements to prepend. + * @param xs the collection containing the elements to prepend. */ def prependAll(xs: TraversableOnce[A]) { xs ++=: this } @@ -220,10 +220,7 @@ trait BufferLike[A, +This <: BufferLike[A, This] with Buffer[A]] * @param xs the traversable object. * @return a new collection consisting of all the elements of this collection and `xs`. */ - @migration(2, 8, - "As of 2.8, ++ always creates a new collection, even on Buffers.\n"+ - "Use ++= instead if you intend to add by side effect to an existing collection.\n" - ) + @migration("`++` creates a new buffer. Use `++=` to add an element from this buffer and return that buffer itself.", "2.8.0") def ++(xs: GenTraversableOnce[A]): This = clone() ++= xs.seq @bridge @@ -234,10 +231,7 @@ trait BufferLike[A, +This <: BufferLike[A, This] with Buffer[A]] * @param elem the element to remove. * @return a new collection consisting of all the elements of this collection except `elem`. */ - @migration(2, 8, - "As of 2.8, - always creates a new collection, even on Buffers.\n"+ - "Use -= instead if you intend to remove by side effect from an existing collection.\n" - ) + @migration("`-` creates a new buffer. Use `-=` to remove an element from this buffer and return that buffer itself.", "2.8.0") override def -(elem: A): This = clone() -= elem /** Creates a new collection with all the elements of this collection except the two @@ -249,10 +243,7 @@ trait BufferLike[A, +This <: BufferLike[A, This] with Buffer[A]] * @return a new collection consisting of all the elements of this collection except * `elem1`, `elem2` and those in `elems`. */ - @migration(2, 8, - "As of 2.8, - always creates a new collection, even on Buffers.\n"+ - "Use -= instead if you intend to remove by side effect from an existing collection.\n" - ) + @migration("`-` creates a new buffer. Use `-=` to remove an element from this buffer and return that buffer itself.", "2.8.0") override def -(elem1: A, elem2: A, elems: A*): This = clone() -= elem1 -= elem2 --= elems /** Creates a new collection with all the elements of this collection except those @@ -262,10 +253,7 @@ trait BufferLike[A, +This <: BufferLike[A, This] with Buffer[A]] * @return a new collection with all the elements of this collection except * those in `xs` */ - @migration(2, 8, - "As of 2.8, -- always creates a new collection, even on Buffers.\n"+ - "Use --= instead if you intend to remove by side effect from an existing collection.\n" - ) + @migration("`--` creates a new buffer. Use `--=` to remove an element from this buffer and return that buffer itself.", "2.8.0") override def --(xs: GenTraversableOnce[A]): This = clone() --= xs.seq @bridge def --(xs: TraversableOnce[A]): This = --(xs: GenTraversableOnce[A]) diff --git a/src/library/scala/collection/mutable/DoubleLinkedListLike.scala b/src/library/scala/collection/mutable/DoubleLinkedListLike.scala index 7ad2f9558f..dfb70beeda 100644 --- a/src/library/scala/collection/mutable/DoubleLinkedListLike.scala +++ b/src/library/scala/collection/mutable/DoubleLinkedListLike.scala @@ -91,7 +91,7 @@ trait DoubleLinkedListLike[A, This <: Seq[A] with DoubleLinkedListLike[A, This]] * current node, i.e. `this` node itself will still point "into" the list it * was in. */ - @migration(2, 9, "Double linked list now removes the current node from the list.") + @migration("Double linked list now removes the current node from the list.", "2.9.0") def remove(): Unit = if (nonEmpty) { next.prev = prev if (prev ne null) prev.next = next // because this could be the first node diff --git a/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala b/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala index 32fca1117c..3232179dbb 100644 --- a/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala +++ b/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala @@ -46,12 +46,12 @@ extends AbstractMap[A, B] override def keysIterator: Iterator[A] = imap.keysIterator - @migration(2, 8, "As of 2.8, keys returns Iterable[A] rather than Iterator[A].") + @migration("`keys` returns Iterable[A] rather than Iterator[A].", "2.8.0") override def keys: collection.Iterable[A] = imap.keys override def valuesIterator: Iterator[B] = imap.valuesIterator - @migration(2, 8, "As of 2.8, values returns Iterable[B] rather than Iterator[B].") + @migration("`values` returns Iterable[B] rather than Iterator[B].", "2.8.0") override def values: collection.Iterable[B] = imap.values def iterator: Iterator[(A, B)] = imap.iterator diff --git a/src/library/scala/collection/mutable/MapLike.scala b/src/library/scala/collection/mutable/MapLike.scala index e4b1458e53..b08a4b7bc9 100644 --- a/src/library/scala/collection/mutable/MapLike.scala +++ b/src/library/scala/collection/mutable/MapLike.scala @@ -90,10 +90,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]] * @param kv the key/value mapping to be added * @return a new map containing mappings of this map and the mapping `kv`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new map. To add an element as a\n"+ - "side effect to an existing map and return that map itself, use +=." - ) + @migration("`+` creates a new map. Use `+=` to add an element to this map and return that map itself.", "2.8.0") def + [B1 >: B] (kv: (A, B1)): Map[A, B1] = clone().asInstanceOf[Map[A, B1]] += kv /** Creates a new map containing two or more key/value mappings and all the key/value @@ -106,10 +103,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]] * @param elems the remaining elements to add. * @return a new map containing mappings of this map and two or more specified mappings. */ - @migration(2, 8, - "As of 2.8, this operation creates a new map. To add an element as a\n"+ - "side effect to an existing map and return that map itself, use +=." - ) + @migration("`+` creates a new map. Use `+=` to add an element to this map and return that map itself.", "2.8.0") override def + [B1 >: B] (elem1: (A, B1), elem2: (A, B1), elems: (A, B1) *): Map[A, B1] = clone().asInstanceOf[Map[A, B1]] += elem1 += elem2 ++= elems @@ -121,10 +115,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]] * @param xs the traversable object. * @return a new map containing mappings of this map and those provided by `xs`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new map. To add the elements as a\n"+ - "side effect to an existing map and return that map itself, use ++=." - ) + @migration("`++` creates a new map. Use `++=` to add an element to this map and return that map itself.", "2.8.0") override def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): Map[A, B1] = clone().asInstanceOf[Map[A, B1]] ++= xs.seq @@ -154,10 +145,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]] * @param key the key to be removed * @return a new map with all the mappings of this map except that with a key `key`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new map. To remove an element as a\n"+ - "side effect to an existing map and return that map itself, use -=." - ) + @migration("`-` creates a new map. Use `-=` to remove an element from this map and return that map itself.", "2.8.0") override def -(key: A): This = clone() -= key /** Removes all bindings from the map. After this operation has completed, @@ -223,10 +211,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]] * @return a new map containing all the mappings of this map except mappings * with a key equal to `elem1`, `elem2` or any of `elems`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new map. To remove an element as a\n"+ - "side effect to an existing map and return that map itself, use -=." - ) + @migration("`-` creates a new map. Use `-=` to remove an element from this map and return that map itself.", "2.8.0") override def -(elem1: A, elem2: A, elems: A*): This = clone() -= elem1 -= elem2 --= elems @@ -237,10 +222,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]] * @return a new map with all the key/value mappings of this map except mappings * with a key equal to a key from `xs`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new map. To remove the elements as a\n"+ - "side effect to an existing map and return that map itself, use --=." - ) + @migration("`--` creates a new map. Use `--=` to remove an element from this map and return that map itself.", "2.8.0") override def --(xs: GenTraversableOnce[A]): This = clone() --= xs.seq @bridge def --(xs: TraversableOnce[A]): This = --(xs: GenTraversableOnce[A]) diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala index 23a68c1d3e..381cb09e18 100644 --- a/src/library/scala/collection/mutable/PriorityQueue.scala +++ b/src/library/scala/collection/mutable/PriorityQueue.scala @@ -12,7 +12,7 @@ package scala.collection package mutable import generic._ -import annotation.{migration, bridge} +import annotation.bridge /** This class implements priority queues using a heap. * To prioritize elements of type A there must be an implicit diff --git a/src/library/scala/collection/mutable/SetLike.scala b/src/library/scala/collection/mutable/SetLike.scala index c5eeb1ae7f..5e201d9959 100644 --- a/src/library/scala/collection/mutable/SetLike.scala +++ b/src/library/scala/collection/mutable/SetLike.scala @@ -141,10 +141,7 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] * @param elem the element to add. * @return a new set consisting of elements of this set and `elem`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new set. To add an element as a\n"+ - "side effect to an existing set and return that set itself, use +=." - ) + @migration("`+` creates a new set. Use `+=` to add an element to this set and return that set itself.", "2.8.0") override def + (elem: A): This = clone() += elem /** Creates a new set consisting of all the elements of this set and two or more @@ -158,10 +155,7 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] * @return a new set consisting of all the elements of this set, `elem1`, * `elem2` and those in `elems`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new set. To add the elements as a\n"+ - "side effect to an existing set and return that set itself, use +=." - ) + @migration("`+` creates a new set. Use `+=` to add an element to this set and return that set itself.", "2.8.0") override def + (elem1: A, elem2: A, elems: A*): This = clone() += elem1 += elem2 ++= elems @@ -173,10 +167,7 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] * @param xs the traversable object. * @return a new set consisting of elements of this set and those in `xs`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new set. To add the elements as a\n"+ - "side effect to an existing set and return that set itself, use ++=." - ) + @migration("`++` creates a new set. Use `++=` to add elements to this set and return that set itself.", "2.8.0") override def ++(xs: GenTraversableOnce[A]): This = clone() ++= xs.seq @bridge def ++(xs: TraversableOnce[A]): This = ++(xs: GenTraversableOnce[A]) @@ -186,10 +177,7 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] * @param elem the element to remove. * @return a new set consisting of all the elements of this set except `elem`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new set. To remove the element as a\n"+ - "side effect to an existing set and return that set itself, use -=." - ) + @migration("`-` creates a new set. Use `-=` to remove an element from this set and return that set itself.", "2.8.0") override def -(elem: A): This = clone() -= elem /** Creates a new set consisting of all the elements of this set except the two @@ -201,10 +189,7 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] * @return a new set consisting of all the elements of this set except * `elem1`, `elem2` and `elems`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new set. To remove the elements as a\n"+ - "side effect to an existing set and return that set itself, use -=." - ) + @migration("`-` creates a new set. Use `-=` to remove an element from this set and return that set itself.", "2.8.0") override def -(elem1: A, elem2: A, elems: A*): This = clone() -= elem1 -= elem2 --= elems @@ -215,10 +200,7 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]] * @return a new set consisting of all the elements of this set except * elements from `xs`. */ - @migration(2, 8, - "As of 2.8, this operation creates a new set. To remove the elements as a\n"+ - "side effect to an existing set and return that set itself, use --=." - ) + @migration("`--` creates a new set. Use `--=` to remove elements from this set and return that set itself.", "2.8.0") override def --(xs: GenTraversableOnce[A]): This = clone() --= xs.seq @bridge def --(xs: TraversableOnce[A]): This = --(xs: GenTraversableOnce[A]) diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala index ffac3b78b7..8fad131009 100644 --- a/src/library/scala/collection/mutable/Stack.scala +++ b/src/library/scala/collection/mutable/Stack.scala @@ -156,17 +156,17 @@ extends AbstractSeq[A] * * @return an iterator over all stack elements. */ - @migration(2, 8, "Stack iterator and foreach now traverse in FIFO order.") + @migration("`iterator` traverses in FIFO order.", "2.8.0") override def iterator: Iterator[A] = elems.iterator /** Creates a list of all stack elements in LIFO order. * * @return the created list. */ - @migration(2, 8, "Stack iterator and foreach now traverse in FIFO order.") + @migration("`toList` traverses in FIFO order.", "2.8.0") override def toList: List[A] = elems - @migration(2, 8, "Stack iterator and foreach now traverse in FIFO order.") + @migration("`foreach` traverses in FIFO order.", "2.8.0") override def foreach[U](f: A => U): Unit = super.foreach(f) /** This method clones the stack. diff --git a/src/library/scala/collection/mutable/StringBuilder.scala b/src/library/scala/collection/mutable/StringBuilder.scala index 603086d209..d9ad58f054 100644 --- a/src/library/scala/collection/mutable/StringBuilder.scala +++ b/src/library/scala/collection/mutable/StringBuilder.scala @@ -403,7 +403,7 @@ final class StringBuilder(private val underlying: JavaStringBuilder) * * @return the reversed StringBuilder */ - @migration(2, 8, "Since 2.8 reverse returns a new instance. Use 'reverseContents' to update in place.") + @migration("`reverse` returns a new instance. Use `reverseContents` to update in place and return that StringBuilder itself.", "2.8.0") override def reverse: StringBuilder = new StringBuilder(new JavaStringBuilder(underlying) reverse) override def clone(): StringBuilder = new StringBuilder(new JavaStringBuilder(underlying)) diff --git a/src/library/scala/collection/mutable/SynchronizedMap.scala b/src/library/scala/collection/mutable/SynchronizedMap.scala index 8b2c6faa41..6e3ae13ada 100644 --- a/src/library/scala/collection/mutable/SynchronizedMap.scala +++ b/src/library/scala/collection/mutable/SynchronizedMap.scala @@ -40,14 +40,14 @@ trait SynchronizedMap[A, B] extends Map[A, B] { override def getOrElseUpdate(key: A, default: => B): B = synchronized { super.getOrElseUpdate(key, default) } override def transform(f: (A, B) => B): this.type = synchronized[this.type] { super.transform(f) } override def retain(p: (A, B) => Boolean): this.type = synchronized[this.type] { super.retain(p) } - @migration(2, 8, "As of 2.8, values returns Iterable[B] rather than Iterator[B].") + @migration("`values` returns `Iterable[B]` rather than `Iterator[B]`.", "2.8.0") override def values: collection.Iterable[B] = synchronized { super.values } override def valuesIterator: Iterator[B] = synchronized { super.valuesIterator } override def clone(): Self = synchronized { super.clone() } override def foreach[U](f: ((A, B)) => U) = synchronized { super.foreach(f) } override def apply(key: A): B = synchronized { super.apply(key) } override def keySet: collection.Set[A] = synchronized { super.keySet } - @migration(2, 8, "As of 2.8, keys returns Iterable[A] rather than Iterator[A].") + @migration("`keys` returns `Iterable[A]` rather than `Iterator[A]`.", "2.8.0") override def keys: collection.Iterable[A] = synchronized { super.keys } override def keysIterator: Iterator[A] = synchronized { super.keysIterator } override def isEmpty: Boolean = synchronized { super.isEmpty } diff --git a/src/library/scala/io/Codec.scala b/src/library/scala/io/Codec.scala index 487f9c7b87..8533ed493f 100644 --- a/src/library/scala/io/Codec.scala +++ b/src/library/scala/io/Codec.scala @@ -97,7 +97,7 @@ object Codec extends LowPriorityCodecImplicits { new Codec(decoder.charset()) { override def decoder = _decoder } } - @migration(2, 9, "This method was previously misnamed `toUTF8`. Converts from Array[Byte] to Array[Char].") + @migration("This method was previously misnamed `toUTF8`. Converts from Array[Byte] to Array[Char].", "2.9.0") def fromUTF8(bytes: Array[Byte]): Array[Char] = { val bbuffer = java.nio.ByteBuffer wrap bytes val cbuffer = UTF8.charSet decode bbuffer @@ -107,7 +107,7 @@ object Codec extends LowPriorityCodecImplicits { chars } - @migration(2, 9, "This method was previously misnamed `fromUTF8`. Converts from character sequence to Array[Byte].") + @migration("This method was previously misnamed `fromUTF8`. Converts from character sequence to Array[Byte].", "2.9.0") def toUTF8(cs: CharSequence): Array[Byte] = { val cbuffer = java.nio.CharBuffer wrap cs val bbuffer = UTF8.charSet encode cbuffer diff --git a/src/library/scala/math/BigDecimal.scala b/src/library/scala/math/BigDecimal.scala index 553fb08c18..497de92c80 100644 --- a/src/library/scala/math/BigDecimal.scala +++ b/src/library/scala/math/BigDecimal.scala @@ -13,7 +13,6 @@ import java.{ lang => jl } import java.math.{ MathContext, BigDecimal => BigDec } import scala.collection.immutable.NumericRange -import annotation.migration /** * @author Stephane Micheloud diff --git a/src/library/scala/math/Ordered.scala b/src/library/scala/math/Ordered.scala index b67146942f..53d618db63 100644 --- a/src/library/scala/math/Ordered.scala +++ b/src/library/scala/math/Ordered.scala @@ -58,11 +58,11 @@ trait Ordered[A] extends java.lang.Comparable[A] { * * Returns `x` where: * - * - `x < 0` when `this > that` + * - `x < 0` when `this < that` * * - `x == 0` when `this == that` * - * - `x < 0` when `this > that` + * - `x > 0` when `this > that` * */ def compare(that: A): Int diff --git a/src/library/scala/math/Ordering.scala b/src/library/scala/math/Ordering.scala index b23165154c..d007ae3780 100644 --- a/src/library/scala/math/Ordering.scala +++ b/src/library/scala/math/Ordering.scala @@ -10,7 +10,7 @@ package scala.math import java.util.Comparator -/** Ordering is trait whose instances each represent a strategy for sorting +/** Ordering is a trait whose instances each represent a strategy for sorting * instances of a type. * * Ordering's companion object defines many implicit objects to deal with diff --git a/src/library/scala/util/parsing/combinator/Parsers.scala b/src/library/scala/util/parsing/combinator/Parsers.scala index 751539243b..4004a01ad9 100644 --- a/src/library/scala/util/parsing/combinator/Parsers.scala +++ b/src/library/scala/util/parsing/combinator/Parsers.scala @@ -89,14 +89,14 @@ trait Parsers { sealed abstract class ParseResult[+T] { /** Functional composition of ParseResults. * - * @param `f` the function to be lifted over this result + * @param f the function to be lifted over this result * @return `f` applied to the result of this `ParseResult`, packaged up as a new `ParseResult` */ def map[U](f: T => U): ParseResult[U] /** Partial functional composition of ParseResults. * - * @param `f` the partial function to be lifted over this result + * @param f the partial function to be lifted over this result * @param error a function that takes the same argument as `f` and * produces an error message to explain why `f` wasn't applicable * (it is called when this is the case) @@ -240,7 +240,7 @@ trait Parsers { // no filter yet, dealing with zero is tricky! - @migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.") + @migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0") def append[U >: T](p0: => Parser[U]): Parser[U] = { lazy val p = p0 // lazy argument Parser{ in => this(in) append p(in)} } @@ -259,7 +259,7 @@ trait Parsers { * but easier to pattern match on) that contains the result of `p` and * that of `q`. The resulting parser fails if either `p` or `q` fails. */ - @migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.") + @migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0") def ~ [U](q: => Parser[U]): Parser[~[T, U]] = { lazy val p = q // lazy argument (for(a <- this; b <- p) yield new ~(a,b)).named("~") } @@ -272,7 +272,7 @@ trait Parsers { * succeeds -- evaluated at most once, and only when necessary. * @return a `Parser` that -- on success -- returns the result of `q`. */ - @migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.") + @migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0") def ~> [U](q: => Parser[U]): Parser[U] = { lazy val p = q // lazy argument (for(a <- this; b <- p) yield b).named("~>") } @@ -287,7 +287,7 @@ trait Parsers { * @param q a parser that will be executed after `p` (this parser) succeeds -- evaluated at most once, and only when necessary * @return a `Parser` that -- on success -- returns the result of `p`. */ - @migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.") + @migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0") def <~ [U](q: => Parser[U]): Parser[T] = { lazy val p = q // lazy argument (for(a <- this; b <- p) yield a).named("<~") } @@ -302,7 +302,7 @@ trait Parsers { * `p ~! q` succeeds if `p` succeeds and `q` succeeds on the input left over by `p`. * In case of failure, no back-tracking is performed (in an earlier parser produced by the `|` combinator). * - * @param q a parser that will be executed after `p` (this parser) succeeds + * @param p a parser that will be executed after `p` (this parser) succeeds * @return a `Parser` that -- on success -- returns a `~` (like a Pair, but easier to pattern match on) * that contains the result of `p` and that of `q`. * The resulting parser fails if either `p` or `q` fails, this failure is fatal. @@ -332,7 +332,7 @@ trait Parsers { * @param q0 a parser that accepts if p consumes less characters. -- evaluated at most once, and only when necessary * @return a `Parser` that returns the result of the parser consuming the most characters (out of `p` and `q`). */ - @migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.") + @migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0") def ||| [U >: T](q0: => Parser[U]): Parser[U] = new Parser[U] { lazy val q = q0 // lazy argument def apply(in: Input) = { @@ -367,7 +367,7 @@ trait Parsers { * @param v The new result for the parser, evaluated at most once (if `p` succeeds), not evaluated at all if `p` fails. * @return a parser that has the same behaviour as the current parser, but whose successful result is `v` */ - @migration(2, 9, "As of 2.9, the call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.") + @migration("The call-by-name argument is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0") def ^^^ [U](v: => U): Parser[U] = new Parser[U] { lazy val v0 = v // lazy argument def apply(in: Input) = Parser.this(in) map (x => v0) @@ -706,7 +706,7 @@ trait Parsers { * @return A parser that returns a list of results produced by first applying `f` and then * repeatedly `p` to the input (it only succeeds if `f` matches). */ - @migration(2, 9, "As of 2.9, the p0 call-by-name arguments is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.") + @migration("The `p0` call-by-name arguments is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.", "2.9.0") def rep1[T](first: => Parser[T], p0: => Parser[T]): Parser[List[T]] = Parser { in => lazy val p = p0 // lazy argument val elems = new ListBuffer[T] @@ -733,9 +733,9 @@ trait Parsers { * `repN(n, p)` uses `p` exactly `n` time to parse the input * (the result is a `List` of the `n` consecutive results of `p`). * - * @param p a `Parser` that is to be applied successively to the input - * @param n the exact number of times `p` must succeed - * @return A parser that returns a list of results produced by repeatedly applying `p` to the input + * @param p a `Parser` that is to be applied successively to the input + * @param num the exact number of times `p` must succeed + * @return A parser that returns a list of results produced by repeatedly applying `p` to the input * (and that only succeeds if `p` matches exactly `n` times). */ def repN[T](num: Int, p: => Parser[T]): Parser[List[T]] = |