summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-04-15 02:39:32 +0000
committerPaul Phillips <paulp@improving.org>2011-04-15 02:39:32 +0000
commitbffb951f84e6731ce27eab8dada1653b8bbde34d (patch)
tree6d2333a6f46cecd83f4b473c190bda63da1ddaa9
parent5ff4875db319ee2fef559c3e581100bedc84a184 (diff)
downloadscala-bffb951f84e6731ce27eab8dada1653b8bbde34d.tar.gz
scala-bffb951f84e6731ce27eab8dada1653b8bbde34d.tar.bz2
scala-bffb951f84e6731ce27eab8dada1653b8bbde34d.zip
Some mopping up having to do with deprecated ga...
Some mopping up having to do with deprecated gaining an argument, which may or may not cure scaladoc of its current assertion failure. No review.
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala3
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala11
3 files changed, 10 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index d17077b129..bbdbb09a9d 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -408,7 +408,8 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
def isStrictFP = hasAnnotation(ScalaStrictFPAttr) || (enclClass hasAnnotation ScalaStrictFPAttr)
def isSerializable = info.baseClasses.exists(p => p == SerializableClass || p == JavaSerializableClass) || hasAnnotation(SerializableAttr) // last part can be removed, @serializable annotation is deprecated
def isDeprecated = hasAnnotation(DeprecatedAttr)
- def deprecationMessage = getAnnotation(DeprecatedAttr) flatMap { _.stringArg(0) }
+ def deprecationMessage = getAnnotation(DeprecatedAttr) flatMap (_ stringArg 0)
+ def deprecationVersion = getAnnotation(DeprecatedAttr) flatMap (_ stringArg 1)
// !!! when annotation arguments are not literal strings, but any sort of
// assembly of strings, there is a fair chance they will turn up here not as
// Literal(const) but some arbitrary AST. However nothing in the compiler
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 96ff17e897..a1ff7d99ef 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -895,7 +895,7 @@ abstract class ClassfileParser {
in.skip(attrLen)
case tpnme.DeprecatedATTR =>
val arg = Literal(Constant("see corresponding Javadoc for more information."))
- sym.addAnnotation(AnnotationInfo(definitions.DeprecatedAttr.tpe, List(arg), List()))
+ sym addAnnotation AnnotationInfo(definitions.DeprecatedAttr.tpe, List(arg, Literal(Constant(""))), Nil)
in.skip(attrLen)
case tpnme.ConstantValueATTR =>
val c = pool.getConstant(in.nextChar)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 5d6796b41a..fb71c8caae 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2738,10 +2738,13 @@ trait Typers extends Modes {
error(t.pos, "unexpected tree after typing annotation: "+ typedAnn)
}
- if (annType.typeSymbol == DeprecatedAttr && (argss.isEmpty || argss.head.isEmpty))
- unit.deprecationWarning(ann.pos,
- "the `deprecated' annotation now takes a (message: String) as parameter\n"+
- "indicating the reason for deprecation. That message is printed to the console and included in scaladoc.")
+ if (annType.typeSymbol == DeprecatedAttr && argss.flatten.size < 2)
+ unit.deprecationWarning(ann.pos, """
+ |The `deprecated` annotation now takes two String parameters: the first is
+ |an explanation and/or recommended alternative, which will be printed to the
+ |console and also appear in the scaladoc. The second is the first released
+ |version in which the member was deprecated.""".trim.stripMargin
+ )
if ((typedAnn.tpe == null) || typedAnn.tpe.isErroneous) annotationError
else annInfo(typedAnn)