summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-01-14 15:41:20 -0800
committerPaul Phillips <paulp@improving.org>2013-01-14 15:46:25 -0800
commitf98ccad8d59c6e63a7e4e984f18c3e2b39ed0b68 (patch)
treec1deefa7ba184a09b3adddad183123957983a8ad /src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
parent61f70e48cecddf27fba162c165dfaf712c84278c (diff)
downloadscala-f98ccad8d59c6e63a7e4e984f18c3e2b39ed0b68.tar.gz
scala-f98ccad8d59c6e63a7e4e984f18c3e2b39ed0b68.tar.bz2
scala-f98ccad8d59c6e63a7e4e984f18c3e2b39ed0b68.zip
Tweaked meta-annotation error based on feedback.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
index 438c783810..b226591c8d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
@@ -179,11 +179,12 @@ trait MethodSynthesis {
val targetClass = defaultAnnotationTarget(tree)
val retained = deriveAnnotations(annotations, targetClass, keepClean = true)
- annotations filterNot (retained contains _) foreach (ann => issueAnnotationWarning(ann, targetClass))
+ annotations filterNot (retained contains _) foreach (ann => issueAnnotationWarning(tree, ann, targetClass))
}
- private def issueAnnotationWarning(ann: AnnotationInfo, defaultTarget: Symbol) {
+ private def issueAnnotationWarning(tree: Tree, ann: AnnotationInfo, defaultTarget: Symbol) {
global.reporter.warning(ann.pos,
- s"Annotation is unused - it can be retained with a meta-annotation such as @($ann @${defaultTarget.name})")
+ s"no valid targets for annotation on ${tree.symbol} - it is discarded unused. " +
+ s"You may specify targets with meta-annotations, e.g. @($ann @${defaultTarget.name})")
}
def addDerivedTrees(typer: Typer, stat: Tree): List[Tree] = stat match {
@@ -203,7 +204,7 @@ trait MethodSynthesis {
// well as fields of the class, etc.
if (!mods.isParamAccessor) annotations foreach (ann =>
if (!trees.exists(_.symbol hasAnnotation ann.symbol))
- issueAnnotationWarning(ann, GetterTargetClass)
+ issueAnnotationWarning(vd, ann, GetterTargetClass)
)
trees