<div dir="auto"><div>Hello Archie,</div><div dir="auto"><br></div><div dir="auto">Thank you for your response.</div><div dir="auto"><br></div><div dir="auto">> Also note that what exactly </div><div dir="auto">> case-insensitive means depends on your</div><div dir="auto">> choice of Locale (see also <a href="https://stackoverflow.com/q/8899929/263801" target="_blank" rel="noreferrer">this link</a>). That</div><div dir="auto">> may or may not matter depending on the</div><div dir="auto">> approach.</div><div dir="auto"><br></div><div dir="auto">Good catch, ty. From what I have read, it seems like java class names must be limited to a very small set of ASCII characters, and even within that set, there are more restrictions. Based on that, and the fact that class names must match their created .class file names (with the exception of the aforementioned suffixes/signifiers), I think we should be good for either of our suggested solutions. Unless I misunderstand Locale and it's impacts?</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">> Even a warning is non-trivial. It's normal</div><div dir="auto">> to overwrite existing class files, so you</div><div dir="auto">> couldn't rely on checking whether the file</div><div dir="auto">> already existed. The file manager would</div><div dir="auto">> have to keep track of every class file that</div><div dir="auto">> it has written out so it could detect when</div><div dir="auto">> a clash occurs, or something like that.</div><div dir="auto"><br></div><div dir="auto">Fair point. And furthermore, that tracking you are describing is likely what would be needed if we want the compiler to be robust enough to handle these valid class names without making a .zip file.</div><div dir="auto"><br></div><div dir="auto">> That would work for synthetic inner</div><div dir="auto">> classes. It still doesn't solve the larger</div><div dir="auto">> problem though.</div><div dir="auto"><br></div><div dir="auto">I'm not following.</div><div dir="auto"><br></div><div dir="auto">To my understanding, $ is a valid character in Java class names and .class filenames. It is also strongly discouraged for developers to intentionally name their classes like that. Reason being that the compiler wants to use that character for handling things like Abc$1.java like I mentioned before.</div><div dir="auto"><br></div><div dir="auto">So, when we compile our classes using javac, the compiler checks for name conflicts between all provided java classes (keeping in mind the casing and how it plays with OS'), then generates a unique suffix for all "conflicting" class names.</div><div dir="auto"><br></div><div dir="auto">Then, you name each "conflicting" class name with their respective class name + suffix, and then you literally put in Abc$1 as the explicit class inside of the .class files. That way, during runtime, we know which class is referencing which .class file, and vice versa.</div><div dir="auto"><br></div><div dir="auto">Let's use your code as an example. You wrote the following execution.</div><div dir="auto"><br></div><div dir="auto">---</div><div dir="auto"><div dir="auto">$ javac -d classes {a,b}/*.java</div><div dir="auto">$ ls classes/</div><div dir="auto">Foo.class</div><div dir="auto">---</div><div dir="auto"><br></div><div dir="auto">As you showed previously, the above will fail at runtime because only one .class file was generated.</div><div dir="auto"><br></div><div dir="auto">I am suggesting this behaviour instead.</div><div dir="auto"><br></div><div dir="auto">---</div><div dir="auto"><div dir="auto">$ javac -d classes {a,b}/*.java</div><div dir="auto">$ ls classes/</div><div dir="auto">FOO$1.class Foo$2.class</div></div><div dir="auto">---</div><div dir="auto"><br></div><div dir="auto">Now, each class file is unique, regardless of OS casing. And if we were to open up these 2 class files, they wouldn't reference each other using Foo and FOO - they would use FOO$1 and Foo$2. That way, they know where exactly what .class file to reference, as there is only one match.</div></div><div dir="auto"><br></div><div dir="auto">Would that not work as a solution for both of our scenarios?</div><div dir="auto"><br></div><div dir="auto">Thank you for time and insight!</div><div dir="auto">David Alayachew</div></div>