This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Not the best error message.


Mo DeJong wrote:

> Gcj is giving me this really strange error
> message.

> Any comments on what this sort of error *should* print?

I guess the compilers are getting confused because you have "Crash" declared
in package "foo" and "Crash_Test" in the empty package, yet they are both in
the same directory?

So in this case, the ideal error message should be something like "class
"Crash" was declared in package "foo" but was not found in a directory
called "foo" relative to the base directory for compilation". However, I'm
not sure that a compiler can legally give that error (maybe a warning?),
without checking that parent directory heirarchy is correct for the package
declaration, and that would probibly differ from javac's behaviour.

The "duplicate class" errors are strange but probibly a feature of the way
classes are resolved - the compiler reads Crash.java once and sees that the
class is called foo.Crash, then reads it again after seeing that there is no
class called "Crash" loaded and that there is a file called Crash.java,
since you specified Crash.java on the command line as well. The "type not
found" errors are certainly correct (just not as verbose as they could be).

FWIW, if they are put in the correct package, javac reports the correct
error (Crash_Inner not visible to Crash because it has default access),
while gcj incorrectly compiles the code without an error.

regards

  [ bryce ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]