diff options
author | michelou <michelou@epfl.ch> | 2005-07-05 18:31:46 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2005-07-05 18:31:46 +0000 |
commit | 7ca0b11f155c07eaa3b674b6b16b30c089521257 (patch) | |
tree | e40ca81066bc5936bc0850f67551216bf7624211 /sources | |
parent | bdfec77a20f1ea10e1eaefe02fca83823c672ae6 (diff) | |
download | scala-7ca0b11f155c07eaa3b674b6b16b30c089521257.tar.gz scala-7ca0b11f155c07eaa3b674b6b16b30c089521257.tar.bz2 scala-7ca0b11f155c07eaa3b674b6b16b30c089521257.zip |
- prints out which checked exceptions a method ...
- prints out which checked exceptions a method may throw.
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/tools/scalap/JavaWriter.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sources/scala/tools/scalap/JavaWriter.scala b/sources/scala/tools/scalap/JavaWriter.scala index 37ff3c9412..38afed674f 100644 --- a/sources/scala/tools/scalap/JavaWriter.scala +++ b/sources/scala/tools/scalap/JavaWriter.scala @@ -148,6 +148,20 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer print(getType(tpe) + ";").newline; } } + attribs find { + case cf.Attribute(name, _) => getName(name) == "Exceptions" + } match { + case Some(cf.Attribute(_, data)) => + val n = ((data(0) & 0xff) << 8) + (data(1) & 0xff); + indent.print("throws "); + for (val i <- Iterator.range(0, n) map {x => 2 * (x + 1)}) { + val inx = ((data(i) & 0xff) << 8) + (data(i+1) & 0xff); + if (i > 2) print(", "); + print(getClassName(inx).trim()); + } + undent.newline; + case None => + } } def printClassHeader = { |