Open
Description
(Part of the epic, #139)
- Expose new command line options to
scalac
(and later to thescala
script runner) (--module-path
, etc) - Build atop
StandardJavaFileManager
andjava.lang.module._
, to process these options and create aClassPath
implementation and resolved module graph - Update
Context.isAccessible
to check for reads/exports edges between the call site and referenced symbol. - To support mixed compilation, add a parser for
module-info.java
, and feed a descriptor of the module descriptor to the module graph configuration.
WIP: https://github.com/retronym/scala/tree/topic/jpms
% qscalac -nobootcp -modulepath "" $(f "class C { def foo = javax.xml.bind.DatatypeConverter.printBase64Binary _ }")
/tmp/a.scala:1: error: object DatatypeConverter is not a member of package javax.xml.bind
class C { def foo = javax.xml.bind.DatatypeConverter.printBase64Binary _ }
^
one error found
% qscalac -nobootcp -modulepath "" -addmodules:java.xml.bind $(f "class C { def foo = javax.xml.bind.DatatypeConverter.printBase64Binary _ }")
% qscalac -nobootcp -modulepath "" $(f "class C { sun.reflect.misc.ConstructorUtil.getConstructors(null) }")
/tmp/a.scala:1: error: class ConstructorUtil in package misc cannot be accessed in package sun.reflect.misc
class C { sun.reflect.misc.ConstructorUtil.getConstructors(null) }
^
one error found
% qscalac -nobootcp -modulepath "" -addexports:java.base/sun.reflect.misc=ALL-UNNAMED $(f "class C { sun.reflect.misc.ConstructorUtil.getConstructors(null) }")
Non Goals
Support for --module-source-path
. A batch of source files will be associated with at most one module.
Open Issues
How should we structure our build to allow us to call Java 9 APIs from this code path? I'm thinking we do this from a small pure-Java project and incorporate the results into scala-reflect.jar
, similar to how we've dealt with scala-asm
.