This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Not the best error message.
- To: java at gcc dot gnu dot org
- Subject: Not the best error message.
- From: Mo DeJong <mdejong at cygnus dot com>
- Date: Sun, 6 May 2001 18:57:15 -0700 (PDT)
Hi all.
Gcj is giving me this really strange error
message. I was able to figure out what the
problem was, but I think gcj should be
touched up a bit so that a better error
message is provided. Here is the test case.
% cat Crash.java
package foo;
public class Crash {
static class Crash_Inner {}
}
% cat Crash_Test.java
//import foo.Crash;
class Crash_Test {
void foo() {
Crash.Crash_Inner i = null;
}
}
% gcj -C Crash.java Crash_Test.java
./Crash.java:3: Class `foo.Crash' already defined in Crash.java:3.
public class Crash {
^
./Crash.java:4: confused by earlier errors, bailing out
The problem can be fixed by uncommenting the import statement
in the second file. Of course, my real question is ...
what should this error message be?
The javac error message is a little better, but it
also goes on about a duplicate class.
% javac Crash.java Crash_Test.java
./Crash.java:3: duplicate class: foo.Crash
public class Crash {
^
Crash_Test.java:5: cannot resolve symbol
symbol : class Crash_Inner
location: class Crash
Crash.Crash_Inner i = null;
^
2 errors
The error message printed by Jikes is not very
clear either:
% jikes Crash.java Crash_Test.java
Found 2 semantic errors compiling "Crash_Test.java":
5. Crash.Crash_Inner i = null;
<--->
*** Error: Type Crash was not found.
5. Crash.Crash_Inner i = null;
<--------->
*** Error: Type Crash$Crash_Inner was not found.
Found 1 semantic error compiling "Crash.java":
3. public class Crash {
<--->
*** Error: Duplicate declaration of type "Crash". The other occurrence is
at location Crash.java:3.
Any comments on what this sort of error *should* print?
Mo DeJong
Red Hat Inc