ceylon/ceylon-compiler — Issue #289: Generating 'throws' clause for checked Exceptions
Author: tombentley
Created: 2011-12-16 09:15:37+00:00
State: open

I've just noticed this part of the JVM spec: http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#84639 Previously I'd thought that the whole checked exception thing was a Java-only requirement, and that the JVM was neutral on the matter, but that's obviously incorrect.

The problem here is that there's no such thing as a 'checked' exception in Ceylon, and so we never generate a `throws` clause in the AST, consequently we'll never populate the Exception_attribute of a Method_info. The above part of the spec suggests this is incorrect, though it's hard to see that the JVM itself cares. In the case where a Ceylon method calls a Java method that's declared to throw a checked exception we ought to be generating an AST with a compatible `throws` clause.