summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2008-07-28 10:00:31 +0000
committerMartin Odersky <odersky@gmail.com>2008-07-28 10:00:31 +0000
commitd492b489b176a3d2a4da0d199756af86514be352 (patch)
treee5cf7bedfa037a03f0fbf1bb72564114473edef0 /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
parentc8b3af98b9dd45a358332f60e3bc8f5b8b3c604a (diff)
downloadscala-d492b489b176a3d2a4da0d199756af86514be352.tar.gz
scala-d492b489b176a3d2a4da0d199756af86514be352.tar.bz2
scala-d492b489b176a3d2a4da0d199756af86514be352.zip
fixed #842, #945, #83, #996, #1016, + some perf...
fixed #842, #945, #83, #996, #1016, + some performace tuning.
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index ce98eac3ff..4da75b3e4f 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -707,29 +707,31 @@ abstract class ClassfileParser {
}
/** Parse and return a single annotation. If it is malformed,
- * throw an exception. If it contains a nested annotation,
- * return None.
+ * or it contains a nested annotation, return None.
*/
- def parseAnnotation(attrNameIndex: Char): Option[AnnotationInfo] = {
- val attrType = pool.getType(attrNameIndex)
- val nargs = in.nextChar
- val nvpairs = new ListBuffer[(Name,AnnotationArgument)]
- var nestedAnnot = false // if a nested annotation is seen,
- // then skip this annotation
- for (i <- 0 until nargs) {
- val name = pool.getName(in.nextChar)
- val argConst = parseTaggedConstant
- if (argConst.tag == AnnotationTag)
- nestedAnnot = true
- else
- nvpairs += ((name, new AnnotationArgument(argConst)))
- }
+ def parseAnnotation(attrNameIndex: Char): Option[AnnotationInfo] =
+ try {
+ val attrType = pool.getType(attrNameIndex)
+ val nargs = in.nextChar
+ val nvpairs = new ListBuffer[(Name,AnnotationArgument)]
+ var nestedAnnot = false // if a nested annotation is seen,
+ // then skip this annotation
+ for (i <- 0 until nargs) {
+ val name = pool.getName(in.nextChar)
+ val argConst = parseTaggedConstant
+ if (argConst.tag == AnnotationTag)
+ nestedAnnot = true
+ else
+ nvpairs += ((name, new AnnotationArgument(argConst)))
+ }
- if (nestedAnnot)
- None
- else
- Some(AnnotationInfo(attrType, List(), nvpairs.toList))
- }
+ if (nestedAnnot)
+ None
+ else
+ Some(AnnotationInfo(attrType, List(), nvpairs.toList))
+ } catch {
+ case ex: Throwable => None // ignore malformed annotations ==> t1135
+ }
/** Parse a sequence of annotations and attach them to the
* current symbol sym.