[antlr-interest] @SuppressWarnings("all")

Emond Papegaaij e.papegaaij at student.utwente.nl
Mon Sep 18 01:16:50 PDT 2006


On Sunday 17 September 2006 20:00, Greg Clemenson wrote:
> In Antlr 3.0b4 I can't figure out how to get @SuppressWarnings("all")
> just before the Parser or Lexer class definition in Java.  Putting it
> in the @parser::header section doesn't work, since the Java template
> inserts additional import statements following the inserted
> @SuppressWarnings("all"), causing a Java compile error.  I was
> thinking there might be some sort of @header::preamble section (also
> @lexer::preamble) that could insert such things before the class
> declarations.  Perhaps there is already a mechanism for doing this,
> but I just can't find it?

I'm using this ant rule:
<replaceregexp file="${filename}.java"
    match="^public class"
    replace="@SuppressWarnings(&quot;unchecked&quot;) public class"
    flags="m" />

Maybe ANTLR should have a Java5 target? :)

Best regards,
Emond


More information about the antlr-interest mailing list