summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2009-12-18 10:43:36 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2009-12-18 10:43:36 +0000
commitbbc126660fd65c0aacee03b77f04de91df6959c7 (patch)
tree46e159a4eb87cb71b2387cf11cb79c89975ee617 /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
parent05363648a6f97f3a2175200484bb46df9f9548d5 (diff)
downloadscala-bbc126660fd65c0aacee03b77f04de91df6959c7.tar.gz
scala-bbc126660fd65c0aacee03b77f04de91df6959c7.tar.bz2
scala-bbc126660fd65c0aacee03b77f04de91df6959c7.zip
read the Exceptions attribute from java classfi...
read the Exceptions attribute from java classfiles. 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.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 6f21e3fee9..da4e0aaa49 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -809,6 +809,10 @@ abstract class ClassfileParser {
// TODO 2: also parse RuntimeInvisibleAnnotation / RuntimeInvisibleParamAnnotation,
// i.e. java annotations with RetentionPolicy.CLASS?
+
+ case nme.ExceptionsATTR if (!isScala) =>
+ parseExceptions(attrLen)
+
case _ =>
in.skip(attrLen)
}
@@ -872,6 +876,20 @@ abstract class ClassfileParser {
None // ignore malformed annotations ==> t1135
}
+ /**
+ * Parse the "Exceptions" attribute which denotes the exceptions
+ * thrown by a method.
+ */
+ def parseExceptions(len: Int) {
+ val nClasses = in.nextChar
+ for (n <- 0 until nClasses) {
+ val cls = pool.getClassSymbol(in.nextChar.toInt)
+ sym.addAnnotation(AnnotationInfo(definitions.ThrowsClass.tpe,
+ Literal(Constant(cls.tpe)) :: Nil,
+ Nil))
+ }
+ }
+
/** Parse a sequence of annotations and attach them to the
* current symbol sym.
*/