summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2010-03-26 14:34:34 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2010-03-26 14:34:34 +0000
commit22a037557c68ac5ef4de928977ff2a8a7498710d (patch)
tree6b74fb95c7e4d4282e8852e55156de1d391b0fb6 /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
parent84a2f65e77f9ce4fd56a785268e221f66ad6e82f (diff)
downloadscala-22a037557c68ac5ef4de928977ff2a8a7498710d.tar.gz
scala-22a037557c68ac5ef4de928977ff2a8a7498710d.tar.bz2
scala-22a037557c68ac5ef4de928977ff2a8a7498710d.zip
Unparsed Scala signature annotations are not ad...
Unparsed Scala signature annotations are not added to the symbol table. Review by dragos.
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index f7e78d6588..1453a2138d 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -839,11 +839,9 @@ abstract class ClassfileParser {
// Java annotatinos on classes / methods / fields with RetentionPolicy.RUNTIME
case nme.RuntimeAnnotationATTR =>
if (isScalaAnnot || !isScala) {
- parseAnnotations(attrLen)
+ val scalaSigAnnot = parseAnnotations(attrLen)
if (isScalaAnnot)
- (sym.rawAnnotations find { annot =>
- annot.asInstanceOf[AnnotationInfo].atp == definitions.ScalaSignatureAnnotation.tpe
- }) match {
+ scalaSigAnnot match {
case Some(san: AnnotationInfo) =>
val bytes =
san.assocs.find({ _._1 == nme.bytes }).get._2.asInstanceOf[ScalaSigBytes].bytes
@@ -964,17 +962,20 @@ abstract class ClassfileParser {
}
}
- /** Parse a sequence of annotations and attach them to the
- * current symbol sym.
- */
- def parseAnnotations(len: Int) {
+ /** Parse a sequence of annotations and attaches them to the
+ * current symbol sym, except for the ScalaSignature annotation that it returns, if it is available. */
+ def parseAnnotations(len: Int): Option[AnnotationInfo] = {
val nAttr = in.nextChar
+ var scalaSigAnnot: Option[AnnotationInfo] = None
for (n <- 0 until nAttr)
parseAnnotation(in.nextChar) match {
+ case Some(scalaSig) if (scalaSig.atp == definitions.ScalaSignatureAnnotation.tpe) =>
+ scalaSigAnnot = Some(scalaSig)
case Some(annot) =>
sym.addAnnotation(annot)
case None =>
}
+ scalaSigAnnot
}
// begin parseAttributes