Resolution exception when service interface gets exposed via --add-exports
    Alan Bateman 
    Alan.Bateman at oracle.com
       
    Mon Nov 20 21:24:16 UTC 2017
    
    
  
On 20/11/2017 21:04, Gunnar Morling wrote:
> Hi,
>
> I'm having one module which defines a service interface but does not export
> that interface's package. In another module I wish to create an
> implementation of that service, which should be possible via --add-exports.
>
> I can successfully compile that second module, but running it fails:
>
>      Error occurred during initialization of boot layer
>      j.l.m.ResolutionException: Module com.example.b does not read a module
> that exports com.example.a
>
> It seems as if the service binding happens before the --add-exports of the
> java invocation is processed. Please see below for the steps to reproduce.
>
> Is it a bug or am I trying to do something unsupported here?
>
At run-time, the --add-reads/--add-exports options are the equivalent of 
the module invoking addReads or addExports. So yes, they come into 
effect after resolution and service binding (and so after the resolution 
consistency check that detects that a module uses a service type in a 
package that isn't exported by anyone to the module).
-Alan
    
    
More information about the jigsaw-dev
mailing list