summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-05-01 05:10:09 +0000
committerPaul Phillips <paulp@improving.org>2011-05-01 05:10:09 +0000
commita02b2daa2a46661a3c108d26c738b4dbb836ea4d (patch)
tree314065f06db9ecd55dd3e2850f23a41d7ec5a4a7
parent8182349189250b0da92e566e11e5a59ac22ca805 (diff)
downloadscala-a02b2daa2a46661a3c108d26c738b4dbb836ea4d.tar.gz
scala-a02b2daa2a46661a3c108d26c738b4dbb836ea4d.tar.bz2
scala-a02b2daa2a46661a3c108d26c738b4dbb836ea4d.zip
Don't issue a deprecation warning if the deprec...
Don't issue a deprecation warning if the deprecated method is being called from a bridge method. No review.
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala15
3 files changed, 10 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index a63eb92e6c..5eb8b1ced4 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -412,6 +412,7 @@ 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 hasBridgeAnnotation = hasAnnotation(BridgeClass)
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
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index 7e523d292c..fcf5c077d7 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -60,8 +60,8 @@ abstract class AddInterfaces extends InfoTransform {
{ sym.info; // to set lateMETHOD flag if necessary
sym.isMethod &&
!sym.isLabel &&
- !(sym hasFlag PRIVATE) &&
- (!(sym hasFlag BRIDGE) || (sym hasAnnotation BridgeClass)) && // count @_$bridge$_ annotated classes as interface members
+ !sym.isPrivate &&
+ (!(sym hasFlag BRIDGE) || sym.hasBridgeAnnotation) && // count @_$bridge$_ annotated classes as interface members
!sym.isConstructor &&
!sym.isImplOnly
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index a23e5d704e..099a03acbd 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -1189,15 +1189,14 @@ abstract class RefChecks extends InfoTransform {
//Console.println("is irefutable? " + pat + ":" + pat.tpe + " against " + seltpe + ": " + result);//DEBUG
result
}
- /** If symbol is deprecated and is not contained in a deprecated definition,
- * issue a deprecated warning
+ /** If symbol is deprecated, and the point of reference is not enclosed
+ * in either a deprecated member or a scala bridge method, issue a warning.
*/
private def checkDeprecated(sym: Symbol, pos: Position) {
- if (sym.isDeprecated && !currentOwner.ownerChain.exists(_.isDeprecated)) {
- val dmsg = sym.deprecationMessage
- val msg = sym.toString + sym.locationString +" is deprecated"+
- (if (dmsg.isDefined) ": "+ dmsg.get else "")
- unit.deprecationWarning(pos, msg)
+ if (sym.isDeprecated && !currentOwner.ownerChain.exists(x => x.isDeprecated || x.hasBridgeAnnotation)) {
+ val dmsg = sym.deprecationMessage map (": " + _) getOrElse ""
+
+ unit.deprecationWarning(pos, sym.fullLocationString + " is deprecated" + dmsg)
}
}
/** Similar to deprecation: check if the symbol is marked with @migration
@@ -1205,7 +1204,7 @@ abstract class RefChecks extends InfoTransform {
*/
private def checkMigration(sym: Symbol, pos: Position) = {
for (msg <- sym.migrationMessage)
- unit.warning(pos, "%s%s has changed semantics:\n%s".format(sym, sym.locationString, msg))
+ unit.warning(pos, sym.fullLocationString + " has changed semantics:\n" + msg)
}
/** Check that a deprecated val or def does not override a