Constructing records through reflection and module restrictions
Florian Weimer
fw at deneb.enyo.de
Thu Dec 26 16:44:25 UTC 2024
* Brian Goetz:
> The `opens` clause of a module descriptor indeed can be qualified, just
> as the exports clause can:
>
> ModuleDirective:
> requires {RequiresModifier} ModuleName ;
> exports PackageName [to ModuleName {, ModuleName}] ;
> opens PackageName [to ModuleName {, ModuleName}] ;
> uses TypeName ;
> provides TypeName with TypeName {, TypeName} ;
I think the limitation here is that PackageName cannot be *.
But opens … to is problematic anyway because it breaks encapsulation.
As far as I understand it, it is not transitive. So if a module
changes its serialization provider, for example, opens … to clauses
would have to be adjusted to the new provider module. Even in clients
of the changing module that do not know about the specific
serialization provider being used.
Passing around lookups avoids this issue.
More information about the amber-dev
mailing list