Unclear error message when class has same name as package

Jeremy Manson jeremymanson at google.com
Sat Aug 10 15:10:54 PDT 2013

Hi folks,

One of our users said that he spent a day trying to figure out where how
this error happened (lots of autogenerated code made it all rather opaque),
so I'm reporting it.

$ cat C.java
import p.D.E;

public class C {
$ cat p/D.java
package p;
public class D {
$ cat p/D/E.java
package p.D;

public class E {
$ javac C.java
C.java:1: error: cannot find symbol
import p.D.E;
  symbol:   class E
  location: class D
1 error

The reporter suggested that the error "cannot find symbol" would be better
as something like "package D clashes with class of same name".

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20130810/99f896e6/attachment.html 

More information about the compiler-dev mailing list