Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.3431 :

Posted: Wed Sep 04, 2019 4:08 pm
by dongyingname
Can a jar that owns module-info still becomes a unnamed module?

Option 3:
Just add an empty module-info.java to the jar.
What if the jar is placed on classpath and becomes a unnamed module, which implicitly exports all its packages?

And
Option 2:
Just add module-info to the jar with export clauses for both the packages.
In this case, the library becomes a named module. For all the groups of the company to use it they now have to explicitly requires boundanalytics, don't they? Or is the jar placed on classpass again?

If the answer to my first question is "yes", then option 2 and option 3 are both correct.

I don't know if I am asking these question correctly, as my knowledge of Module is a mess now.
Hope someone can help me answer these questions and clear things up.

Re: About Question enthuware.ocpjp.ii.v11.2.3431 :

Posted: Wed Sep 04, 2019 11:57 pm
by admin
Packages contained in a jar present on classpath can only accessed by automatic modules. So, if you put a jar on classpath, its packages still can't be accessed by named modules.

>For all the groups of the company to use it they now have to explicitly requires boundanalytics, don't they?
Yes, of course, but that is only if they are themselves using modules. Otherwise, regular non-modular applications can keep using the modular jar as before. There is no impact.

You can go through the modules chapter of this book to get the fundamentals required for this exam.

Re: About Question enthuware.ocpjp.ii.v11.2.3431 :

Posted: Sat Apr 10, 2021 10:58 pm
by ardurn
The question mentions a package com.abc.bonds, but the option "Split the jar into two modules" mentions the package com.abc.bond without s in the end. I assume this is a typo?

Re: About Question enthuware.ocpjp.ii.v11.2.3431 :

Posted: Sun Apr 11, 2021 10:55 pm
by admin
Right. It should be bonds. Fixed.
thank you for your feedback!