[antlr-interest] lexer doesn't see super constructor & inherited variable

Johan Grande johan.grande at crans.org
Mon Jul 21 14:35:35 PDT 2008


Raphael Reitzig wrote:
> "Johan Grande" <johan.grande at crans.org> wrote (Mon Jul 21 21:52:53 2008):
> 
>> Raphael Reitzig wrote:
>>> Do you use Java 6 for compilation?
>> Yes.
> 
> Interesting. I just successfully compiled the generated code for the 
> same gramar. No errors, with only antlr-3.0.1 (added to standard lib) in 
> classpath. So, you may have found a bug in the beta you used. *shrug*
> 
I first tried antlr-3.0.1 . But I found a bug in it : in some cases, in 
the generated parser, too many commas are written between arguments 
which correspond to rule parameters, and in my case the generated parser 
didn't compile.
This bug seem to be fixed in antlr-3.1b2, bug now there is that other 
one :-(

But actually, I don't see how there can even be a problem : there is a 
class, org.antlr.runtime.Lexer, which is in the classpath (seen by 
java), which contains a public constructor, and another class, 
JavaLexer, which extends it.
| public class JavaLexer extends Lexer {
|   [...]
|   public JavaLexer(CharStream input, RecognizerSharedState state) {
|     super(input,state);
|     }
|   [...]
| }
How can javac see a class but not a constructor in it ?
I think I can assume the .class included in antlr correspond to the 
.java provided ...

I don't know all the subtleties of Java, but it would be great if you 
could explain me how the bug can just exist.

> # javac -version
> javac 1.6.0_06
> 
Exactly.


Regards,
Johan



More information about the antlr-interest mailing list