diff options
author | Simon Ochsenreither <simon@ochsenreither.de> | 2016-07-26 09:49:12 +0200 |
---|---|---|
committer | Simon Ochsenreither <simon@ochsenreither.de> | 2016-08-02 21:41:25 +0200 |
commit | adb3c010d3b95094161bd6725b3e2077cad98879 (patch) | |
tree | 973608940b5c94c2c7cbfd226058b3ad033bb183 /src | |
parent | 25b29ea4036b0bc910a5eb07d64c93d294be4e55 (diff) | |
download | scala-adb3c010d3b95094161bd6725b3e2077cad98879.tar.gz scala-adb3c010d3b95094161bd6725b3e2077cad98879.tar.bz2 scala-adb3c010d3b95094161bd6725b3e2077cad98879.zip |
Reduce deprecations and warnings
Diffstat (limited to 'src')
16 files changed, 70 insertions, 45 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala index 447ee209b5..fedacdac41 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala @@ -828,8 +828,10 @@ object LocalOptImpls { /** * Replace jumps to a sequence of GOTO instructions by a jump to the final destination. * + * {{{ * Jump l; [any ops]; l: GOTO m; [any ops]; m: GOTO n; [any ops]; n: NotGOTO; [...] * => Jump n; [rest unchanged] + * }}} * * If there's a loop of GOTOs, the initial jump is replaced by one of the labels in the loop. */ @@ -848,8 +850,10 @@ object LocalOptImpls { /** * Eliminates unnecessary jump instructions * + * {{{ * Jump l; [nops]; l: [...] * => POP*; [nops]; l: [...] + * }}} * * Introduces 0, 1 or 2 POP instructions, depending on the number of values consumed by the Jump. */ @@ -865,8 +869,10 @@ object LocalOptImpls { * If the "else" part of a conditional branch is a simple GOTO, negates the conditional branch * and eliminates the GOTO. * + * {{{ * CondJump l; [nops, no jump targets]; GOTO m; [nops]; l: [...] * => NegatedCondJump m; [nops, no jump targets]; [nops]; l: [...] + * }}} * * Note that no jump targets are allowed in the first [nops] section. Otherwise, there could * be some other jump to the GOTO, and eliminating it would change behavior. @@ -893,8 +899,10 @@ object LocalOptImpls { /** * Inlines xRETURN and ATHROW * + * {{{ * GOTO l; [any ops]; l: xRETURN/ATHROW * => xRETURN/ATHROW; [any ops]; l: xRETURN/ATHROW + * }}} * * inlining is only done if the GOTO instruction is not part of a try block, otherwise the * rewrite might change the behavior. For xRETURN, the reason is that return instructions may throw diff --git a/src/compiler/scala/tools/nsc/plugins/Plugin.scala b/src/compiler/scala/tools/nsc/plugins/Plugin.scala index 5caf7e41bf..ed1675e4cc 100644 --- a/src/compiler/scala/tools/nsc/plugins/Plugin.scala +++ b/src/compiler/scala/tools/nsc/plugins/Plugin.scala @@ -64,7 +64,7 @@ abstract class Plugin { true } - @deprecated("use Plugin#init instead", since="2.11") + @deprecated("use Plugin#init instead", since="2.11.0") def processOptions(options: List[String], error: String => Unit): Unit = { if (!options.isEmpty) error(s"Error: $name takes no options") } diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala index cef2fc4bbf..f286cfe246 100644 --- a/src/compiler/scala/tools/nsc/util/ClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala @@ -52,7 +52,7 @@ trait ClassPath { */ def asClassPathString: String = ClassPath.join(asClassPathStrings: _*) // for compatibility purposes - @deprecated("Use asClassPathString instead of this one", "2.11.5") + @deprecated("use asClassPathString instead of this one", "2.11.5") def asClasspathString: String = asClassPathString /** The whole sourcepath in the form of one String. @@ -128,10 +128,10 @@ object ClassPath { resources.asScala.filter(_.getProtocol == "jar").toList } - @deprecated("Shim for sbt's compiler interface", since = "2.12") + @deprecated("shim for sbt's compiler interface", since = "2.12.0") sealed abstract class ClassPathContext - @deprecated("Shim for sbt's compiler interface", since = "2.12") + @deprecated("shim for sbt's compiler interface", since = "2.12.0") sealed abstract class JavaContext } @@ -141,11 +141,11 @@ trait ClassRepresentation { def source: Option[AbstractFile] } -@deprecated("Shim for sbt's compiler interface", since = "2.12") +@deprecated("shim for sbt's compiler interface", since = "2.12.0") sealed abstract class DirectoryClassPath -@deprecated("Shim for sbt's compiler interface", since = "2.12") +@deprecated("shim for sbt's compiler interface", since = "2.12.0") sealed abstract class MergedClassPath -@deprecated("Shim for sbt's compiler interface", since = "2.12") +@deprecated("shim for sbt's compiler interface", since = "2.12.0") sealed abstract class JavaClassPath diff --git a/src/library/scala/collection/JavaConversions.scala b/src/library/scala/collection/JavaConversions.scala index 960e452cdf..93994d80bf 100644 --- a/src/library/scala/collection/JavaConversions.scala +++ b/src/library/scala/collection/JavaConversions.scala @@ -56,5 +56,5 @@ import convert._ * @author Martin Odersky * @since 2.8 */ -@deprecated("Use JavaConverters", since="2.12") +@deprecated("use JavaConverters", since="2.12.0") object JavaConversions extends WrapAsScala with WrapAsJava diff --git a/src/library/scala/collection/convert/WrapAsJava.scala b/src/library/scala/collection/convert/WrapAsJava.scala index e45c1666a5..e3a064b79d 100644 --- a/src/library/scala/collection/convert/WrapAsJava.scala +++ b/src/library/scala/collection/convert/WrapAsJava.scala @@ -13,7 +13,7 @@ package convert import java.{ lang => jl, util => ju }, java.util.{ concurrent => juc } import scala.language.implicitConversions -@deprecated("Use JavaConverters or consider ToJavaImplicits", since="2.12") +@deprecated("use JavaConverters or consider ToJavaImplicits", since="2.12.0") trait WrapAsJava extends LowPriorityWrapAsJava { // provide higher-priority implicits with names that don't exist in JavaConverters for the case // when importing both JavaConverters._ and JavaConversions._. otherwise implicit conversions @@ -286,5 +286,5 @@ private[convert] trait LowPriorityWrapAsJava { } } -@deprecated("Use JavaConverters or consider ImplicitConversionsToJava", since="2.12") +@deprecated("use JavaConverters or consider ImplicitConversionsToJava", since="2.12.0") object WrapAsJava extends WrapAsJava diff --git a/src/library/scala/collection/convert/WrapAsScala.scala b/src/library/scala/collection/convert/WrapAsScala.scala index 514490e348..fbaafde798 100644 --- a/src/library/scala/collection/convert/WrapAsScala.scala +++ b/src/library/scala/collection/convert/WrapAsScala.scala @@ -13,7 +13,7 @@ package convert import java.{ lang => jl, util => ju }, java.util.{ concurrent => juc } import scala.language.implicitConversions -@deprecated("Use JavaConverters or consider ToScalaImplicits", since="2.12") +@deprecated("use JavaConverters or consider ToScalaImplicits", since="2.12.0") trait WrapAsScala extends LowPriorityWrapAsScala { // provide higher-priority implicits with names that don't exist in JavaConverters for the case // when importing both JavaConverters._ and JavaConversions._. otherwise implicit conversions @@ -225,5 +225,5 @@ private[convert] trait LowPriorityWrapAsScala { } } -@deprecated("Use JavaConverters or consider ImplicitConversionsToScala", since="2.12") +@deprecated("use JavaConverters or consider ImplicitConversionsToScala", since="2.12.0") object WrapAsScala extends WrapAsScala diff --git a/src/library/scala/collection/convert/package.scala b/src/library/scala/collection/convert/package.scala index fe1951b6cf..810d112cd5 100644 --- a/src/library/scala/collection/convert/package.scala +++ b/src/library/scala/collection/convert/package.scala @@ -10,17 +10,17 @@ package scala package collection package object convert { - @deprecated("use JavaConverters", since="2.12") + @deprecated("use JavaConverters", since="2.12.0") val decorateAsJava = new DecorateAsJava { } - @deprecated("use JavaConverters", since="2.12") + @deprecated("use JavaConverters", since="2.12.0") val decorateAsScala = new DecorateAsScala { } - @deprecated("use JavaConverters", since="2.12") + @deprecated("use JavaConverters", since="2.12.0") val decorateAll = JavaConverters - @deprecated("use JavaConverters or consider ImplicitConversionsToJava", since="2.12") + @deprecated("use JavaConverters or consider ImplicitConversionsToJava", since="2.12.0") val wrapAsJava = new WrapAsJava { } - @deprecated("use JavaConverters or consider ImplicitConversionsToScala", since="2.12") + @deprecated("use JavaConverters or consider ImplicitConversionsToScala", since="2.12.0") val wrapAsScala = new WrapAsScala { } - @deprecated("use JavaConverters or consider ImplicitConversions", since="2.12") + @deprecated("use JavaConverters or consider ImplicitConversions", since="2.12.0") val wrapAll = new WrapAsJava with WrapAsScala { } } diff --git a/src/library/scala/collection/mutable/BitSet.scala b/src/library/scala/collection/mutable/BitSet.scala index feef694e01..e74ee65dda 100644 --- a/src/library/scala/collection/mutable/BitSet.scala +++ b/src/library/scala/collection/mutable/BitSet.scala @@ -164,7 +164,7 @@ class BitSet(protected final var elems: Array[Long]) extends AbstractSet[Int] */ @deprecated("If this BitSet contains a value that is 128 or greater, the result of this method is an 'immutable' " + "BitSet that shares state with this mutable BitSet. Thus, if the mutable BitSet is modified, it will violate the " + - "immutability of the result.", "2.11.6") + "immutability of the result.", "2.12.0") def toImmutable = immutable.BitSet.fromBitMaskNoCopy(elems) override def clone(): BitSet = { diff --git a/src/library/scala/deprecated.scala b/src/library/scala/deprecated.scala index 7338dffb8d..60f0857550 100644 --- a/src/library/scala/deprecated.scala +++ b/src/library/scala/deprecated.scala @@ -29,26 +29,30 @@ import scala.annotation.meta._ * {{{ * oldMethod(1) * oldMethod(2) - * aDeprecatedMethodFromBarLibrary(3, 4) + * aDeprecatedMethodFromLibraryBar(3, 4) * - * // warning: there were two deprecation warnings (since FooLib 12.0) * // warning: there was one deprecation warning (since BarLib 3.2) + * // warning: there were two deprecation warnings (since FooLib 12.0) * // warning: there were three deprecation warnings in total; re-run with -deprecation for details * }}} * + * '''`@deprecated` in the Scala language and its standard library'''<br/> + * * A deprecated element of the Scala language or a definition in the Scala standard library will * be preserved or at least another major version. * - * This means that an element deprecated since 2.12 will be preserved in 2.13 and will very likely - * not be part of 2.14, though sometimes a deprecated element might be kept for more than a major + * This means that an element deprecated since 2.12 will be preserved in 2.13, but will very likely + * not be part of 2.14. Sometimes a deprecated element might be kept for more than a major * release to ease migration and upgrades from older Scala versions.<br/> * Developers should not rely on this. * - * @note The Scala team has decided to enact a special deprecation policy for the 2.12 release:<br/> + * '''Special deprecation policy for Scala 2.12'''<br> + * The Scala team has decided to enact a special deprecation policy for the 2.12 release:<br/> * - * As an upgrade from Scala 2.11 to Scala 2.12 also requires upgrading from Java 6 to Java 8, - * no deprecated elements will be removed in this release to ease migration and upgrades - * from older Scala versions. + * As an upgrade from Scala 2.11 to Scala 2.12 also requires upgrading from Java 6 to Java 8, + * no deprecated elements will be removed in this release to ease migration and upgrades + * from older Scala versions. This means that elements deprecated since 2.11 (or earlier) + * will not be removed in Scala 2.12. * * @see The official documentation on [[http://www.scala-lang.org/news/2.11.0/#binary-compatibility binary compatibility]]. * @param message the message to print during compilation if the definition is accessed diff --git a/src/library/scala/deprecatedInheritance.scala b/src/library/scala/deprecatedInheritance.scala index b85d07b0bd..bd5daf5de0 100644 --- a/src/library/scala/deprecatedInheritance.scala +++ b/src/library/scala/deprecatedInheritance.scala @@ -15,15 +15,21 @@ package scala * * No warnings are generated if the subclass is in the same compilation unit. * + * Library authors should state the library's deprecation policy in their documentation to give + * developers guidance on when a type annotated with `@deprecatedInheritance` will be `final`ized. + * + * Library authors should prepend the name of their library to the version number to help + * developers distinguish deprecations coming from different libraries: + * * {{{ - * @deprecatedInheritance("this class will be made final", "2.12") + * @deprecatedInheritance("this class will be made final", "FooLib 12.0") * class Foo * }}} * * {{{ * val foo = new Foo // no deprecation warning * class Bar extends Foo - * // warning: inheritance from class Foo is deprecated (since 2.12): this class will be made final + * // warning: inheritance from class Foo is deprecated (since FooLib 12.0): this class will be made final * // class Bar extends Foo * // ^ * }}} diff --git a/src/library/scala/deprecatedName.scala b/src/library/scala/deprecatedName.scala index e2322f0363..f8c6bd32ad 100644 --- a/src/library/scala/deprecatedName.scala +++ b/src/library/scala/deprecatedName.scala @@ -15,14 +15,19 @@ import scala.annotation.meta._ * * Using this name in a named argument generates a deprecation warning. * - * For instance, evaluating the code below in the Scala interpreter (with `-deprecation`) + * Library authors should state the library's deprecation policy in their documentation to give + * developers guidance on how long a deprecated name will be preserved. + * + * Library authors should prepend the name of their library to the version number to help + * developers distinguish deprecations coming from different libraries: + * * {{{ - * def inc(x: Int, @deprecatedName('y, "2.12") n: Int): Int = x + n + * def inc(x: Int, @deprecatedName('y, "FooLib 12.0") n: Int): Int = x + n * inc(1, y = 2) * }}} * will produce the following warning: * {{{ - * warning: the parameter name y is deprecated (since 2.12): use n instead + * warning: the parameter name y is deprecated (since FooLib 12.0): use n instead * inc(1, y = 2) * ^ * }}} diff --git a/src/library/scala/deprecatedOverriding.scala b/src/library/scala/deprecatedOverriding.scala index ee887db220..46639986c0 100644 --- a/src/library/scala/deprecatedOverriding.scala +++ b/src/library/scala/deprecatedOverriding.scala @@ -12,9 +12,15 @@ package scala * * Overriding such a member in a sub-class then generates a warning. * + * Library authors should state the library's deprecation policy in their documentation to give + * developers guidance on when a method annotated with `@deprecatedOverriding` will be `final`ized. + * + * Library authors should prepend the name of their library to the version number to help + * developers distinguish deprecations coming from different libraries: + * * {{{ * class Foo { - * @deprecatedOverriding("this method will be made final", "2.12") + * @deprecatedOverriding("this method will be made final", "FooLib 12.0") * def add(x: Int, y: Int) = x + y * } * }}} @@ -24,7 +30,7 @@ package scala * class Baz extends Foo { * override def add(x: Int, y: Int) = x - y * } - * // warning: overriding method add in class Foo is deprecated (since 2.12): this method will be made final + * // warning: overriding method add in class Foo is deprecated (since FooLib 12.0): this method will be made final * // override def add(x: Int, y: Int) = x - y * // ^ * }}} diff --git a/src/library/scala/util/Random.scala b/src/library/scala/util/Random.scala index 2d38c9d4a0..16d18d7d6d 100644 --- a/src/library/scala/util/Random.scala +++ b/src/library/scala/util/Random.scala @@ -121,9 +121,6 @@ class Random(val self: java.util.Random) extends AnyRef with Serializable { (bf(xs) ++= buf).result() } - @deprecated("Preserved for backwards binary compatibility. To remove in 2.12.x.", "2.11.6") - final def `scala$util$Random$$isAlphaNum$1`(c: Char) = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') - /** Returns a Stream of pseudorandomly chosen alphanumeric characters, * equally chosen from A-Z, a-z, and 0-9. * diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala index ea6ab6aad5..0dd96b2616 100644 --- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala @@ -45,8 +45,8 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) def this(in0: BufferedReader, out: JPrintWriter) = this(Some(in0), out) def this() = this(None, new JPrintWriter(Console.out, true)) - @deprecated("Use `intp` instead.", "2.9.0") def interpreter = intp - @deprecated("Use `intp` instead.", "2.9.0") def interpreter_= (i: Interpreter): Unit = intp = i + @deprecated("use `intp` instead.", "2.9.0") def interpreter = intp + @deprecated("use `intp` instead.", "2.9.0") def interpreter_= (i: Interpreter): Unit = intp = i var in: InteractiveReader = _ // the input stream from which commands come var settings: Settings = _ @@ -73,7 +73,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) def history = in.history // classpath entries added via :cp - @deprecated("Use reset, replay or require to update class path", since = "2.11") + @deprecated("use reset, replay or require to update class path", since = "2.11.0") var addedClasspath: String = "" /** A reverse list of commands to replay if the user requests a :replay */ @@ -594,7 +594,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) else File(filename).printlnAll(replayCommands: _*) ) - @deprecated("Use reset, replay or require to update class path", since = "2.11") + @deprecated("use reset, replay or require to update class path", since = "2.11.0") def addClasspath(arg: String): Unit = { val f = File(arg).normalize if (f.exists) { @@ -1000,7 +1000,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) } } - @deprecated("Use `process` instead", "2.9.0") + @deprecated("use `process` instead", "2.9.0") def main(settings: Settings): Unit = process(settings) //used by sbt } diff --git a/src/scalap/scala/tools/scalap/scalax/rules/Rules.scala b/src/scalap/scala/tools/scalap/scalax/rules/Rules.scala index dd17c46f79..00d86adc29 100644 --- a/src/scalap/scala/tools/scalap/scalax/rules/Rules.scala +++ b/src/scalap/scala/tools/scalap/scalax/rules/Rules.scala @@ -79,7 +79,7 @@ trait Rules { /** A factory for rules that apply to a particular context. * - * @requires S the context to which rules apply. + * @tparam S the context to which rules apply. * * @author Andrew Foggin * diff --git a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/SourceFileAttributeParser.scala b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/SourceFileAttributeParser.scala index fc5a75c046..0595234add 100644 --- a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/SourceFileAttributeParser.scala +++ b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/SourceFileAttributeParser.scala @@ -22,7 +22,6 @@ object SourceFileAttributeParser extends ByteCodeReader { } * * Contains only file index in ConstantPool, first two fields are already treated - * by {@link scalax.rules.scalasig.ClassFile.attribute#attribute} + * by {@link scalax.rules.scalasig.ClassFileParser#attribute} */ case class SourceFileInfo(sourceFileIndex: Int) - |