<div dir="ltr">On Sun, Feb 19, 2023 at 5:56 AM David Alayachew <<a href="mailto:davidalayachew@gmail.com">davidalayachew@gmail.com</a>> wrote:<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">I have seen a lot of recent discussions about class names and how the compiler should generate them (or fail with an error). Seeing that, I wanted to query the group and see if anyone has the bandwidth to look at this and give some insight.<div dir="auto"><br></div><div dir="auto"><a href="https://bugs.openjdk.org/browse/JDK-8287885" target="_blank">https://bugs.openjdk.org/browse/JDK-8287885</a></div></div></blockquote></div><div><br></div><div>This is not just a problem for inner classes and not just for Windows. I can reproduce this on my Macbook (which has case-preserving but case-insensitive filesystem by default) as well:</div><div><br></div><div style="margin-left:40px"><span style="font-family:monospace">$ cat a/Foo.java <br></span></div><div style="margin-left:40px"><span style="font-family:monospace">public class Foo {<br>    public static void main(String[] args) {<br>        System.out.println("Foo");<br>    }<br>}<br>$ cat b/FOO.java <br>public class FOO {<br>    public static void main(String[] args) {<br>        System.out.println("FOO");<br>    }<br>}<br>$ javac -d classes {a,b}/*.java</span></div><div style="margin-left:40px"><span style="font-family:monospace">$ ls classes/<br>Foo.class</span></div><div style="margin-left:40px"><span style="font-family:monospace">$ java -cp classes Foo<br>Error: Could not find or load main class Foo<br>Caused by: java.lang.NoClassDefFoundError: FOO (wrong name: Foo)<br></span></div><div><br></div><div>As the example above shows, just fixing the problem for inner class names would only be a partial fix.</div><div><br></div><div>And of course, this is not just a problem for the compiler, but also the runtime... i.e., you can't load both Foo.class and FOO.class from the same directory. But (in contrast to compilation) that problem you can easily address by putting your classes into a JAR file, etc.<br></div><br><div>So just brainstorming here... what would it take to fix this?</div><div><br></div><div>One could imagine adding a flag like "-dzip classes.zip" which would write the classes to a ZIP file instead of the filesystem.</div><div><br></div><div>So fixing this is do-able but not trivial.. it would take some work to e.g. create a ZIP file implementation of JavacFileManager, etc.<br></div><div><br></div><div>-Archie<br></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>