OpenJDK parser internals
Jonathan Gibbons
jonathan.gibbons at oracle.com
Mon Sep 26 08:17:22 PDT 2011
On 09/25/2011 04:09 PM, Rémi Forax wrote:
>
>>>
>>> 3. Verbose exception handling approach - e.g.
>>> .tools.javac.tree.Pretty - all
>>> the visitor methods wraps implementation in try-catch block though
>>> it is
>>> sufficient to provide Pretty.print implementation that only wraps
>>> out.write
>>> to try-catch block with throwing UncheckedIOException.
>
> No, you want printExpr to throw an IOException.
> Here the main problem is that the visitor is not written in a way that
> let propagate checked exception.
> public class Visitor<E extends Exception> {
> public void visit(JCAssert tree) throw E;
That would be an interesting refactoring, if anyone wanted to try it.
-- Jon
More information about the compiler-dev
mailing list