diff options
28 files changed, 165 insertions, 71 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala index 7b2686e7a9..e04e73304f 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala @@ -1164,4 +1164,7 @@ object BTypes { // no static way (without symbol table instance) to get to nme.ScalaATTR / ScalaSignatureATTR val ScalaAttributeName = "Scala" val ScalaSigAttributeName = "ScalaSig" + + // when inlining, local variable names of the callee are prefixed with the name of the callee method + val InlinedLocalVariablePrefixMaxLenght = 128 } diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala index e21c46dbe9..bfd92cac5c 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala @@ -324,15 +324,33 @@ object BytecodeUtils { * Clone the local variable descriptors of `methodNode` and map their `start` and `end` labels * according to the `labelMap`. */ - def cloneLocalVariableNodes(methodNode: MethodNode, labelMap: Map[LabelNode, LabelNode], prefix: String, shift: Int): List[LocalVariableNode] = { - methodNode.localVariables.iterator().asScala.map(localVariable => new LocalVariableNode( - prefix + localVariable.name, - localVariable.desc, - localVariable.signature, - labelMap(localVariable.start), - labelMap(localVariable.end), - localVariable.index + shift - )).toList + def cloneLocalVariableNodes(methodNode: MethodNode, labelMap: Map[LabelNode, LabelNode], calleeMethodName: String, shift: Int): List[LocalVariableNode] = { + methodNode.localVariables.iterator().asScala.map(localVariable => { + val name = + if (calleeMethodName.length + localVariable.name.length < BTypes.InlinedLocalVariablePrefixMaxLenght) { + calleeMethodName + "_" + localVariable.name + } else { + val parts = localVariable.name.split("_").toVector + val (methNames, varName) = (calleeMethodName +: parts.init, parts.last) + // keep at least 5 characters per method name + val maxNumMethNames = BTypes.InlinedLocalVariablePrefixMaxLenght / 5 + val usedMethNames = + if (methNames.length < maxNumMethNames) methNames + else { + val half = maxNumMethNames / 2 + methNames.take(half) ++ methNames.takeRight(half) + } + val charsPerMethod = BTypes.InlinedLocalVariablePrefixMaxLenght / usedMethNames.length + usedMethNames.foldLeft("")((res, methName) => res + methName.take(charsPerMethod) + "_") + varName + } + new LocalVariableNode( + name, + localVariable.desc, + localVariable.signature, + labelMap(localVariable.start), + labelMap(localVariable.end), + localVariable.index + shift) + }).toList } /** diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala index 9c5a1a9f98..50dd65c56c 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala @@ -382,7 +382,7 @@ class Inliner[BT <: BTypes](val btypes: BT) { callsiteMethod.instructions.insert(callsiteInstruction, clonedInstructions) callsiteMethod.instructions.remove(callsiteInstruction) - callsiteMethod.localVariables.addAll(cloneLocalVariableNodes(callee, labelsMap, callee.name + "_", localVarShift).asJava) + callsiteMethod.localVariables.addAll(cloneLocalVariableNodes(callee, labelsMap, callee.name, localVarShift).asJava) // prepend the handlers of the callee. the order of handlers matters: when an exception is thrown // at some instruction, the first handler guarding that instruction and having a matching exception // type is executed. prepending the callee's handlers makes sure to test those handlers first if 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/Predef.scala b/src/library/scala/Predef.scala index 8de9754b50..5e82062b44 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -337,8 +337,16 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef { @deprecated("use Throwable#getStackTrace", "2.11.0") def getStackTraceString = self.getStackTrace().mkString("", EOL, EOL) } + // Sadly we have to do `@deprecatedName(null, "2.12.0")` because + // `@deprecatedName(since="2.12.0")` incurs a warning about + // Usage of named or default arguments transformed this annotation constructor call into a block. + // The corresponding AnnotationInfo will contain references to local values and default getters + // instead of the actual argument trees + // and `@deprecatedName(Symbol("<none>"), "2.12.0")` crashes scalac with + // scala.reflect.internal.Symbols$CyclicReference: illegal cyclic reference involving object Symbol + // in run/repl-no-imports-no-predef-power.scala. /** @group implicit-classes-char */ - implicit final class SeqCharSequence(val __sequenceOfChars: scala.collection.IndexedSeq[Char]) extends CharSequence { + implicit final class SeqCharSequence(@deprecated("will be made private", "2.12.0") @deprecatedName(null, "2.12.0") val __sequenceOfChars: scala.collection.IndexedSeq[Char]) extends CharSequence { def length: Int = __sequenceOfChars.length def charAt(index: Int): Char = __sequenceOfChars(index) def subSequence(start: Int, end: Int): CharSequence = new SeqCharSequence(__sequenceOfChars.slice(start, end)) @@ -346,7 +354,7 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef { } /** @group implicit-classes-char */ - implicit final class ArrayCharSequence(val __arrayOfChars: Array[Char]) extends CharSequence { + implicit final class ArrayCharSequence(@deprecated("will be made private", "2.12.0") @deprecatedName(null, "2.12.0") val __arrayOfChars: Array[Char]) extends CharSequence { def length: Int = __arrayOfChars.length def charAt(index: Int): Char = __arrayOfChars(index) def subSequence(start: Int, end: Int): CharSequence = new runtime.ArrayCharSequence(__arrayOfChars, start, end) 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/runtime/LambdaDeserializer.scala b/src/library/scala/runtime/LambdaDeserializer.scala index ad7d12ba5d..a6e08e6e61 100644 --- a/src/library/scala/runtime/LambdaDeserializer.scala +++ b/src/library/scala/runtime/LambdaDeserializer.scala @@ -94,13 +94,15 @@ object LambdaDeserializer { val key = serialized.getImplMethodName + " : " + serialized.getImplMethodSignature val factory: MethodHandle = if (cache == null) { makeCallSite.getTarget - } else cache.get(key) match { - case null => - val callSite = makeCallSite - val temp = callSite.getTarget - cache.put(key, temp) - temp - case target => target + } else cache.synchronized{ + cache.get(key) match { + case null => + val callSite = makeCallSite + val temp = callSite.getTarget + cache.put(key, temp) + temp + case target => target + } } val captures = Array.tabulate(serialized.getCapturedArgCount)(n => serialized.getCapturedArg(n)) diff --git a/src/library/scala/sys/process/ProcessBuilder.scala b/src/library/scala/sys/process/ProcessBuilder.scala index 35f3f4d7a5..9713b712fc 100644 --- a/src/library/scala/sys/process/ProcessBuilder.scala +++ b/src/library/scala/sys/process/ProcessBuilder.scala @@ -15,8 +15,8 @@ import ProcessBuilder._ /** Represents a sequence of one or more external processes that can be * executed. A `ProcessBuilder` can be a single external process, or a - * combination of other `ProcessBuilder`. One can control where a - * the output of an external process will go to, and where its input will come + * combination of other `ProcessBuilder`. One can control where the + * output of an external process will go to, and where its input will come * from, or leave that decision to whoever starts it. * * One creates a `ProcessBuilder` through factories provided in 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) - diff --git a/test/files/jvm/serialization-new.check b/test/files/jvm/serialization-new.check index 5b8a08da82..964c68e528 100644 --- a/test/files/jvm/serialization-new.check +++ b/test/files/jvm/serialization-new.check @@ -1,5 +1,5 @@ warning: there were two deprecation warnings (since 2.11.0) -warning: there was one deprecation warning (since 2.11.6) +warning: there was one deprecation warning (since 2.12.0) warning: there were three deprecation warnings in total; re-run with -deprecation for details a1 = Array[1,2,3] _a1 = Array[1,2,3] diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check index 5b8a08da82..964c68e528 100644 --- a/test/files/jvm/serialization.check +++ b/test/files/jvm/serialization.check @@ -1,5 +1,5 @@ warning: there were two deprecation warnings (since 2.11.0) -warning: there was one deprecation warning (since 2.11.6) +warning: there was one deprecation warning (since 2.12.0) warning: there were three deprecation warnings in total; re-run with -deprecation for details a1 = Array[1,2,3] _a1 = Array[1,2,3] diff --git a/test/files/neg/t9684.check b/test/files/neg/t9684.check index ab36479a47..bb5669733d 100644 --- a/test/files/neg/t9684.check +++ b/test/files/neg/t9684.check @@ -1,7 +1,7 @@ -t9684.scala:6: warning: object JavaConversions in package collection is deprecated (since 2.12): Use JavaConverters +t9684.scala:6: warning: object JavaConversions in package collection is deprecated (since 2.12.0): use JavaConverters null.asInstanceOf[java.util.List[Int]] : Buffer[Int] ^ -t9684.scala:8: warning: object JavaConversions in package collection is deprecated (since 2.12): Use JavaConverters +t9684.scala:8: warning: object JavaConversions in package collection is deprecated (since 2.12.0): use JavaConverters null.asInstanceOf[Iterable[Int]] : java.util.Collection[Int] ^ error: No warnings can be incurred under -Xfatal-warnings. diff --git a/test/files/run/array-charSeq.check b/test/files/run/array-charSeq.check index f1f374f63e..3ccf493cee 100644 --- a/test/files/run/array-charSeq.check +++ b/test/files/run/array-charSeq.check @@ -1,3 +1,4 @@ +warning: there were two deprecation warnings (since 2.12.0); re-run with -deprecation for details [check 'abcdefghi'] len = 9 sub(0, 9) == 'abcdefghi' diff --git a/test/files/run/bitsets.check b/test/files/run/bitsets.check index 770d9b5e3f..89e51f9a78 100644 --- a/test/files/run/bitsets.check +++ b/test/files/run/bitsets.check @@ -1,4 +1,4 @@ -warning: there were three deprecation warnings (since 2.11.6); re-run with -deprecation for details +warning: there were three deprecation warnings (since 2.12.0); re-run with -deprecation for details ms0 = BitSet(2) ms1 = BitSet(2) ms2 = BitSet(2) diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala index f531ce9322..f88b95eae4 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala @@ -1587,4 +1587,41 @@ class InlinerTest extends BytecodeTesting { val List(c, t) = compile(code) assertNoIndy(getMethod(c, "t1")) } + + @Test + def limitInlinedLocalVariableNames(): Unit = { + val code = + """class C { + | def f(x: Int): Int = x + | @inline final def methodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(param: Int) = + | f(param) + | @inline final def anotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(param: Int) = + | methodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(param)) + | @inline final def oneMoreMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(param: Int) = + | anotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(param)) + | @inline final def yetAnotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(param: Int) = + | oneMoreMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(param)) + | @inline final def oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(param: Int) = + | yetAnotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(param)) + | def t(p: Int) = + | oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(p)) + + | oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(p)) + |} + """.stripMargin + + val List(c) = compile(code) + assertEquals(getAsmMethod(c, "t").localVariables.asScala.toList.map(l => (l.name, l.index)).sortBy(_._2),List( + ("this",0), + ("p",1), + ("oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence_param",2), + ("oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchS_yetAnotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFren_param",3), + ("oneLastMethodWithVeryVeryLongNameAlmostLik_yetAnotherMethodWithVeryVeryLongNameAlmost_oneMoreMethodWithVeryVeryLongNameAlmostLik_param",4), + ("oneLastMethodWithVeryVeryLongNam_yetAnotherMethodWithVeryVeryLong_oneMoreMethodWithVeryVeryLongNam_anotherMethodWithVeryVeryLongNam_param",5), + ("oneLastMethodWithVeryVery_yetAnotherMethodWithVeryV_oneMoreMethodWithVeryVery_anotherMethodWithVeryVery_methodWithVeryVeryLongNam_param",6), + ("oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence_param",7), + ("oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchS_yetAnotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFren_param",8), + ("oneLastMethodWithVeryVeryLongNameAlmostLik_yetAnotherMethodWithVeryVeryLongNameAlmost_oneMoreMethodWithVeryVeryLongNameAlmostLik_param",9), + ("oneLastMethodWithVeryVeryLongNam_yetAnotherMethodWithVeryVeryLong_oneMoreMethodWithVeryVeryLongNam_anotherMethodWithVeryVeryLongNam_param",10), + ("oneLastMethodWithVeryVery_yetAnotherMethodWithVeryV_oneMoreMethodWithVeryVery_anotherMethodWithVeryVery_methodWithVeryVeryLongNam_param",11))) + } } |