I have a tree parser that's doing semantic analysis on the AST generated by my parser. It has a rule declared as follows:
transitionDefinition throws WorkflowStateNotFoundException: /* ... */
This compiles just fine and matches the rule syntax at the ANTLR Wiki but my exception is never declared so the Java compiler complains about undeclared exceptions.
./tool/src/main/antlr3/org/antlr/grammar/v3/ANTLRv3.g shows that it's building a tree (but I'm not actually positive if it's the v2 or v3 grammar that ANTLR 3.2 is using):
throwsSpec
: 'throws' id ( ',' id )* -> ^('throws' id+)
;
I know I can make it a runtime exception, but I'd like to use my exception hierarchy. Am I doing something wrong or should that syntax work?