Unclear error message when class has same name as package

Jeremy Manson jeremymanson at google.com
Tue Aug 13 12:36:51 PDT 2013


Thanks!

Jeremy


On Tue, Aug 13, 2013 at 2:31 AM, Vicente-Arturo Romero-Zaldivar <
vicente.romero at oracle.com> wrote:

> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20130813/a00e6355/attachment.html 


More information about the compiler-dev mailing list