<div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 22, 2024 at 12:58 AM Jonathan Gibbons <<a href="mailto:jonathan.gibbons@oracle.com">jonathan.gibbons@oracle.com</a>> wrote:</div><div dir="ltr" class="gmail_attr"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
As for common sense, maybe, but maybe not. It is effectively impossible <br>
to anticipate all the quirks of all the file systems that may be <br>
encountered while compiling a program. That being said, it is arguable <br>
that `javac` should ignore any files that are not the well-formed <br>
filename of a valid Java class.<br></blockquote><div><br></div><div>Thanks Jonathan. I did wonder a bit why the file scanning was including all file types in this context. (fileKinds includes JavaFileObject.Kind.OTHER).  </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> o If yes, would it be worthwhile to improve the error reporting?  <br>
> "Cannot access unnamed package" is not super helpful, "error accessing <br>
> directory" is also somewhat vague.<br>
Well, you did get a very helpful and very specific error message .... <br>
`Illegal char <:> at index 4: file:txt`<br></blockquote><div><br></div><div>Yes, that last part was indeed helpful in diagnosing the problem at the implementation level.</div><div><br></div><div>While this is probably unlikely to happen in any properly organized, version controlled code base, experimental code using JEP-330 might be more likely to stumble upon it. This was what happened to me when I discovered this while using "java HelloWorld.java" in some scratch directory containing some oddly named, partially downloaded files.   </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> o At the very least, should we add a space in the IOException message <br>
> thrown by DirectoryContainer.list, to separate the file path from <br>
> the InvalidPathException toString?<br></blockquote><div><br></div><div>I filed JDK-8338815 to track this trivial enhancement, and will follow up with a PR shortly.</div><div><br></div><div>Cheers,</div><div>Eirik. </div></div></div>