On 19/11/2016 14:44, Remi Forax wrote:

Hi all,
Currently the spec supports two ways to declare several providers for one 
service:
   provides com.github.forax.pro.main.runner.Runner
     with com.github.forax.pro.main.JSONRunner,
          com.github.forax.pro.main.JShellRunner;
or
   provides com.github.forax.pro.main.runner.Runner with 
com.github.forax.pro.main.JSONRunner;
   provides com.github.forax.pro.main.runner.Runner with 
com.github.forax.pro.main.JShellRunner;

but the equivalent code declared using the ModuleDescriptor.Builder.provides() 
fails.
The second form isn't allowed but javac is temporarily allowing it during the transition.

So the exception is correct, except that I would expect InvalidModuleDescriptorException with what you have as the cause.

-Alan


cheers,
Rémi

Exception in thread "main" java.lang.IllegalStateException: Providers of 
service com.github.forax.pro.main.runner.Runner already declared by 
com.github.forax.pro.main
        at 
java.base/java.lang.module.ModuleDescriptor$Builder.provides(ModuleDescriptor.java:1807)
        at 
com.github.forax.pro.helper/com.github.forax.pro.helper.ModuleHelper$1.visitProvides(ModuleHelper.java:84)
        at 
com.github.forax.pro.helper/com.github.forax.pro.helper.ModuleParser.parseProvides(ModuleParser.java:262)
        at 
com.github.forax.pro.helper/com.github.forax.pro.helper.ModuleParser.parseModule(ModuleParser.java:202)
        at 
com.github.forax.pro.helper/com.github.forax.pro.helper.ModuleParser.parse(ModuleParser.java:153)
        at 
com.github.forax.pro.helper/com.github.forax.pro.helper.ModuleHelper$1.parse(ModuleHelper.java:89)
        at 
com.github.forax.pro.helper/com.github.forax.pro.helper.ModuleHelper.sourceModuleDescriptor(ModuleHelper.java:95)
         ...



Reply via email to