[antlr-interest] unreachable catch block

Warren Falk warren-antlr.org at warrenfalk.com
Thu May 14 18:36:43 PDT 2009


>>
>> Would I be out of place to still think this is a bug?  Shouldn't the
>> code to catch the RecognizerException only be emitted if the code that
>> throws it is also emitted?
>>
> not always...you could put a throw in an action :)
> Ter

well, exactly, and that is precisely when I would expect to be
required to add my own catch because it's *my* throw...  Adding a
dummy catch to suppress a default, erroneous behavior, on the other
hand, seems a bit of a perversion.  (I mean, it's only erroneous
because this is a "checked" exception, so Java expects catches only
for throws... if ANTLR isn't supposed to be designed that way, then
couldn't this just be fixed by having RecognizerException extend
RuntimeException instead?)


More information about the antlr-interest mailing list