Unclear error message when class has same name as package
Vicente-Arturo Romero-Zaldivar
vicente.romero at oracle.com
Tue Aug 13 02:31:36 PDT 2013
Hi Jeremy,
Thanks for the report I have created a bug entry with id JDK-8022873 to
track this issue,
Vicente
On 10/08/13 23:10, Jeremy Manson wrote:
> 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".
>
> Jeremy
More information about the compiler-dev
mailing list