Module access question
Karen Kinnear
karen.kinnear at oracle.com
Sat Apr 3 08:42:26 PDT 2010
Riaz,
Also note that access control for module-private is not coming in the
OJ timeframe.
thanks,
Karen
On Apr 2, 2010, at 6:24 PM, Alex Buckley wrote:
> Yes, just make the types in foo.impl be module-private via the
> "module" keyword. They can extend/implement the public types in
> foo.api, but will be inaccessible to types outside the foo module.
> Of course there will probably be some public factory or other entry
> point in foo.impl to get things going.
>
> Note that the "module" accessibility level is a feature of JSR 294,
> but which types are in which module is a property of the module
> system you are using. In the RI of JSR 294, javac determines which
> types are in the "foo" module versus in other modules based on the
> modulepath.
>
> Alex
>
> On 4/2/2010 3:16 PM, Riaz A Aimandi wrote:
>> Hi,
>> I have a quick question regarding modules.
>> Lets say I have a module that has both API & Implementation (in
>> different packages)
>> Is it possible to restrict access from other modules to API only
>> (both at compile & runtime) ?
>> i.e., disallow implementation classes to be directly accessed from
>> other modules.
>> Example:
>> Module foo:
>> package foo.api.* : has API
>> package foo.impl.* has Implementation
>> I want to restrict direct access to foo.impl.* from any module
>> that requires this module.
>> I understand that with multiple modules this could be easily done.
>> But I am hoping that I do not have to breakup modules just for this
>> purpose.
>> Thanks,
>> - riaz
More information about the jigsaw-dev
mailing list