Closed alec-bernardi closed 2 months ago
I'm willing to bet this is related to #716
Is this still valid? Meanwhile, we reworked our TestRunner a bit, so chances are high, this issue is already fixed.
Also, can you point to a working example?
Going to call this fixed since we reworked the testrunner classloader hierarchy in https://github.com/com-lihaoyi/mill/commit/f944ceb96565385953ba7fe6869100da24025b03 which makes the user code run in the root classloader
When using libraries that supply a custom
CharsetProvider
, the providedCharset
implementations are not available in tests.I am not super knowledgeable with regard to classloading in the JVM, but it seems this stems from the fact that the
CharsetProvider
implementations are loaded with the system classloader, while mill'sTestRunner
loads the runtime classpath of the test using the context classloader of a subprocess. Since the JVM isn't started with JCharset on the classpath, I don't believe theServiceLoader
will be able to find theMETA-INF/services/java.nio.charset.spi.CharsetProvider
withinjcharset-2.1.jar
.This issue is demonstrated on OpenJDK 8 by the following example project, which depends on https://www.freeutils.net/source/jcharset/ for the
ISO-8859-8-BIDI
character encoding:./build.sc
:./foo/test/src/CharsetTest.scala
:The output of
mill foo.test
: