Skip to content

Commit

Permalink
- prints out which checked exceptions a method ...
Browse files Browse the repository at this point in the history
- prints out which checked exceptions a method may throw.
  • Loading branch information
michelou committed Jul 5, 2005
1 parent bdfec77 commit 7ca0b11
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sources/scala/tools/scalap/JavaWriter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 7ca0b11

Please sign in to comment.