[antlr-interest] Re: unchecked calls warnings compiling the lexer

Michael Studman mstudman at gmx.net
Wed Sep 29 03:40:19 PDT 2004


Hi.

I think the "pragma" Chris is referring to is the
@SuppressWarnings("unchecked") annotation which is much talked about but
not yet supported in the Java 1.5 compiler (apparently it will be
supported in 1.5.1). Once this is supported you might be able to add
this annotation to the parser/lexer preamble in your grammar file to
stop the compilation warnings:

{@SupressWarnings("unchecked")}
class YourParserClass extends Parser;
...
...

But until this happens or until Antlr supports generating Java 1.5 code
the only simple option is to put up with the warning. While it would be
nice not to have to worry about spurious warning messages, the one
identified is far from fatal and won't stop you from developing with
Antlr under Java 1.5. The warning in question simply indicates that the
generic method "put" on Hashtable has been called in a non-generic
fashion.

Joan also refers to the -source option of the Javac compiler. If your
grammar file was fairly self contained and had no use of generics or
other 1.5 language features, you could conceivably compile ONLY the
generated lexer/parser code using the "-source 1.4" option, then compile
the rest of your project (presumably using 1.5 language features) using
"-source 1.5" and then package all the class files together. This will
stop warning messages and should work well thanks to JVM/javac backward
compatibility with older class file versions, but depending on your
project and its class/package coupling it may not be that easy to do.

Michael.
 
> -----Original Message-----
> From: Joan Pujol [mailto:joanpujol at gmail.com]
> Sent: 29 September 2004 08:19
> To: antlr-interest at yahoogroups.com
> Subject: Re: [antlr-interest] Re: unchecked calls warnings compiling
the
> lexer
> 
> Hi,
> 
> I haven't tested it but the java compiler have this option:
> 
> -source release
>     Specifies the version of source code accepted. The following
> values for release are allowed:
>     1.3 	the compiler does not support assertions, generics, or
other
> language features introduced after JDK 1.3.
>     1.4 	the compiler accepts code containing assertions, which
were
> introduced in JDK 1.4.
>     1.5 	the compiler accepts code containing generics and other
> language features introduced in JDK 5. The compiler defaults to the
> version 5 behavior if the -source flag is not used.
>     5 	Synonym for 1.5
> 
> Cheers,
> 
> 
> On Wed, 29 Sep 2004 00:39:39 +0300, Anakreon <anakreonmejdi at yahoo.gr>
> wrote:
> > kozchris wrote:
> > > I some some talk about a @PRAGMA addition to remove the warnings
but
> > > was unable to verify.
> > >
> > > Chris
> > >
> > Consider using jikes for the files generated by antlr and javac for
the
> rest.
> > The class files are backward compatible, so there should be no
problem
> in mixing
> > the two sets of class files.
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> 
> 
> 
> --
> Joan Jesús Pujol Espinar
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.769 / Virus Database: 516 - Release Date: 24/09/2004
> 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.769 / Virus Database: 516 - Release Date: 24/09/2004
 



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list