Closed
Description
When run the test set with JDK 11, we get two errors:
(1) Failure in project/scripts/bootstrapCmdTests
+ ./project/scripts/sbt ';dotty-compiler-bootstrapped/dotc -with-compiler tests/run-staging/quote-run.scala; dotty-compiler-bootstrapped/dotr -with-compiler Test'
Exception in thread "main" dotty.tools.dotc.MissingCoreLibraryException: Could not find package scalaShadowing from compiler core libraries.
Make sure the compiler core libraries are on the classpath.
at dotty.tools.dotc.core.Denotations$.select$1(Denotations.scala:1222)
at dotty.tools.dotc.core.Denotations$.recurSimple$1(Denotations.scala:1250)
at dotty.tools.dotc.core.Denotations$.recur$1(Denotations.scala:1252)
at dotty.tools.dotc.core.Denotations$.staticRef(Denotations.scala:1254)
at dotty.tools.dotc.core.Symbols$.requiredPackage(Symbols.scala:890)
at dotty.tools.dotc.core.Definitions.ScalaShadowingPackage(Definitions.scala:255)
at dotty.tools.dotc.core.Definitions.init(Definitions.scala:1496)
at dotty.tools.dotc.core.Contexts$ContextBase.initialize(Contexts.scala:790)
at dotty.tools.dotc.core.Contexts$Context.initialize(Contexts.scala:554)
at dotty.tools.dotc.Run.rootContext(Run.scala:64)
at dotty.tools.dotc.Run.<init>(Run.scala:84)
at scala.quoted.staging.QuoteCompiler$ExprRun.<init>(QuoteCompiler.scala:102)
at scala.quoted.staging.QuoteCompiler.newRun(QuoteCompiler.scala:45)
at scala.quoted.staging.QuoteDriver.run(QuoteDriver.scala:40)
at scala.quoted.staging.Toolbox$$anon$1.run(Toolbox.scala:36)
at scala.quoted.staging.package$.run(staging.scala:19)
at Test$.main(quote-run.scala:12)
at Test.main(quote-run.scala)
(2) tests/run-staging/i6992
-- Error: tests/run-staging/i6992/Test_2.scala:7:16 -------------------------------
7 | println(mcr {foo})
| ^^^^^^^^^
| Exception occurred while executing macro expansion.
| dotty.tools.dotc.MissingCoreLibraryException: Could not find package scalaShadowing from compiler core libraries.
| Make sure the compiler core libraries are on the classpath.
The errors originate from a change of class loading in Java 9 (due to the module system):
In Java 9, the classloader is no longer a URLClassLoader
, which breaks the following code:
There exists a hack to achieve similar results in Java 9+
Related PR: #9181