<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Jeremy,<br>
<br>
To be realistic, I do not know what we can do about this issue.
It is legal to have a class and a package with the same name,
which means that in a sufficiently perverse case, and the
following import<br>
<br>
import A.B.C.D.E;<br>
<br>
the problem could occur at any point along the qualified name,
where the compiler chooses a type name contrary to the erroneous
expectation of the programmer. See JLS 6.5.4.<br>
<br>
So, as much as it would be nice to be able to warn the programmer
of problematic coding, this error message is not the place to do
it. The compiler already tries to give you enough detail by
point out (in your case) that it is trying to find "class E"
within "class D". That should surely be enough to have you
realize that the compiler is looking at "class D" and not "package
D".<br>
<br>
-- Jon<br>
<br>
<br>
On 08/13/2013 12:36 PM, Jeremy Manson wrote:<br>
</div>
<blockquote
cite="mid:CAPYFHW12U1XGibuHRyr9rBVMSk0B92A7gKaDES9H41bRuuKOqQ@mail.gmail.com"
type="cite">
<div dir="ltr">Thanks!
<div><br>
</div>
<div>Jeremy</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Aug 13, 2013 at 2:31 AM,
Vicente-Arturo Romero-Zaldivar <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:vicente.romero@oracle.com" target="_blank">vicente.romero@oracle.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jeremy,<br>
<br>
Thanks for the report I have created a bug entry with id
JDK-8022873 to track this issue,<br>
<br>
Vicente
<div class="HOEnZb">
<div class="h5"><br>
<br>
On 10/08/13 23:10, Jeremy Manson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi folks,<br>
<br>
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.<br>
<br>
$ cat C.java<br>
import p.D.E;<br>
<br>
public class C {<br>
}<br>
$ cat p/D.java<br>
package p;<br>
public class D {<br>
}<br>
$ cat p/D/E.java<br>
package p.D;<br>
<br>
public class E {<br>
}<br>
$ javac C.java<br>
C.java:1: error: cannot find symbol<br>
import p.D.E;<br>
^<br>
symbol: class E<br>
location: class D<br>
1 error<br>
<br>
<br>
The reporter suggested that the error "cannot find
symbol" would be better as something like "package D
clashes with class of same name".<br>
<br>
Jeremy<br>
</blockquote>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>