On 05/12/2017 01:02 PM, David M. Lloyd wrote:
On 05/12/2017 08:31 AM, David M. Lloyd wrote:
On 05/12/2017 03:22 AM, Alan Bateman wrote:
On 12/05/2017 01:43, David M. Lloyd wrote:

I've proposed five patches to the jpms-spec-experts list [1..5] for discussion. The patches are as follows:

[...]
3. Layer primitive: addPackage() - allows ModuleLayer.Controllers to add packages to a module after it has been defined
[...]
However for #3 then you've missed several important error cases, e.g. illegal package names, or the package is already in another module defined to the class loader. There is impact in other areas too.

I wasn't worried about validating package names at first, because I figured that you could never define a class to the package anyway, but nevertheless I see the value in error detection (and avoiding piles of cruft inside the JVM regardless of whether it might trip any kind of internal assertion, which I acknowledge as a possibility as well), so I've pushed up a patch [1] to add package name validation. This also detects the empty package name situation.

Detecting package conflict is somewhat more subtle; that's coming up next.

[1] https://github.com/dmlloyd/openjdk-modules/commit/a636c8891d6958d7b395a57d17c95699ee549500

Here [2] is my first pass at detecting package conflict. As an additional precaution, I forbid packages to be added to the bootstrap class loader in this way.

[2] https://github.com/dmlloyd/openjdk-modules/commit/f02719801ac41c6fd9b8c216f16c3f86b909e5fe


--
- DML

Reply via email to