Closed CPColin closed 7 years ago
@CPColin Thanks, should be fixed now, please try it out.
The commit looks good, but I've never built the ceylon
project before, so it might be a bit before I can verify the functionality. I think this can be verified by changing the assumeTrue
in test.ceylon.locale::testAmPm
to assertTrue
; the locale being unable to load was why I made it an assumeTrue
, if I remember correctly.
I'll get my Windows environment upgraded to Eclipse Oxygen and Ceylon 1.3.3 and test this soon!
Confirmed! Checked out the version-1.3.3
branch and had to revert the ceylon.test
module from 1.3.3.1
to 1.3.3
to get it to compile, but I can confirm that the testAmPm
test completes properly on Windows now. Thanks!
Great!
The code in
com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ModuleImpl.resourceByPath()
callsJVMModuleUtil.quoteJavaKeywordsInFilename()
, which loads the passed path as ajava.io.File
object and callsgetName()
on that object. In Windows, the resulting path uses backslashes instead of forward slashes. When this new path is passed toRuntimeModelLoader.getContents()
a few lines down, that method returnsnull
, becauseCachedTOCJar.containsFile()
checks a set that exclusively uses forward slashes.This leads to
ceylon.locale::locale()
being unable to load any locales, as discussed here:https://groups.google.com/d/msg/ceylon-users/mhg1sGaX3js/p-1pKT5_AgAJ
This behavior likely affects all module resource loading in Windows, when the
module-resources
directory is not present on disk. If that directory is available, as when a developer is currently developing a module, the second strategy inresourceByPath()
will probably successfully find the resource and the developer will be none the wiser, until somebody imports the published module.Note that the other place that uses
quoteJavaKeywordsInFilename()
evades the problem by replacing all backslashes with forward slashes.