@@ -24,6 +24,8 @@ import Contexts._
2424import Types ._
2525import Symbols ._
2626import Denotations ._
27+ import Decorators ._
28+
2729import Phases ._
2830import java .lang .AssertionError
2931import java .io .{DataOutputStream , File => JFile }
@@ -188,18 +190,19 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
188190 val claszSymbol = cd.symbol
189191
190192 // GenASM checks this before classfiles are emitted, https://github.com/scala/scala/commit/e4d1d930693ac75d8eb64c2c3c69f2fc22bec739
191- // todo: add back those checks
192- /* val lowercaseJavaClassName = claszSymbol.javaClassName.toLowerCase
193+ val lowercaseJavaClassName = claszSymbol.name.toString.toLowerCase
193194 caseInsensitively.get(lowercaseJavaClassName) match {
194195 case None =>
195196 caseInsensitively.put(lowercaseJavaClassName, claszSymbol)
196197 case Some (dupClassSym) =>
197- reporter.warning(
198- claszSymbol.pos,
199- s"Class ${claszSymbol.javaClassName} differs only in case from ${dupClassSym.javaClassName}. " +
200- "Such classes will overwrite one another on case-insensitive filesystems."
201- )
202- }*/
198+ // Order is not deterministic so we enforce lexicographic order between the duplicates for error-reporting
199+ if (claszSymbol.name.toString < dupClassSym.name.toString)
200+ ctx.warning(s " Class ${claszSymbol.name} differs only in case from ${dupClassSym.name}. " +
201+ " Such classes will overwrite one another on case-insensitive filesystems." , claszSymbol.pos)
202+ else
203+ ctx.warning(s " Class ${dupClassSym.name} differs only in case from ${claszSymbol.name}. " +
204+ " Such classes will overwrite one another on case-insensitive filesystems." , dupClassSym.pos)
205+ }
203206
204207 // -------------- mirror class, if needed --------------
205208 val mirrorC =
0 commit comments