Ambiguous class error with gcj, but not javac

P

Paul Johnson

I'm building an example from the ANTLR distribution, which apparently
works fine when compiled with javac. However, I've currently only got
gcj, so I'm using 'gcj -C' instead of javac. The problem is that the
compile fails with an ambiguous class error.

Disclaimer: I know no Java at all, and I'm hoping that I've given
enough information here to make it obvious whether or not there's a
problem. AFAIK, you can only get an ambiguous class error for two
classes with the same name, and that isn't the case here.

An auto-generated file has these imports:
import antlr.Token;
import CToken; // line 27

gcj --classpath .:/eda/antlr/antlr-2.7.5/lib/antlr.jar -C StdCLexer.java
StdCLexer.java:27: error: Ambiguous class: `CToken' and `antlr.Token'.
import CToken;
^

but these classes have different names. CToken extends
antlr.CommonToken, antlr.CommonToken extends antlr.Token. If I comment
out 'import antlr.Token' the compiler segfaults. This is gcj 3.3,
Linux RH7.2.

Any ideas?

Thanks -

PJ
 
A

Alex Buell

but these classes have different names. CToken extends
antlr.CommonToken, antlr.CommonToken extends antlr.Token. If I comment
out 'import antlr.Token' the compiler segfaults. This is gcj 3.3,
Linux RH7.2.

I've just compiled 2.7.4 with gcj 3.3.5, no problems there. I'd suggest
upgrading your GCC/GCJ tool-chain.
 
P

Paul Johnson

I've just compiled 2.7.4 with gcj 3.3.5, no problems there. I'd suggest
upgrading your GCC/GCJ tool-chain.

Thanks. I've just installed Centos(RHEL) 4, which comes with gcj
3.4.3, but I get the same error (though without the segfault).
Note that I can compile ANTLR itself on gcj 3.3 - this is the cgram
example. I guess I'll just have to download javac or jikes and give
that a go...

Cheers

PJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,263
Messages
2,571,062
Members
48,769
Latest member
Clifft

Latest Threads

Top