Re-export (was: Updated JSR-277 specification (04/19/2007))
Stanley M. Ho
Stanley.Ho at sun.com
Mon May 14 18:12:52 PDT 2007
Hi Michal,
Michal Cierniak wrote:
> Stanley,
>
> Do you also think that JSR-294 will have to understand re-exports to
> correctly enforce information hiding at compile time? If so, do you
> expect that if module A imports and re-exports module B then all of
> B's exports will be added to A's exports? If this question is
> answered in the draft, I missed the answer.
I think the module-aware compiler will definitely need to understand
re-exports for proper compilation. That said, whether this is done at
the JSR 294's level will depend on the outcome of the "import"
discussion in the JSR 294 EG, which I expect will happen sometimes soon.
> Independently of 294's decision, do you think that this should happen
> for 277 modules? I don't have a strong preference one way or another
> but I think that it may be a little better if we required that B's
> exported classes are added to A's export list. The benefit is that
> some of the resolution and validation algorithms might become simpler.
> The downside is that we will repeat information in multiple places.
> We would have to decide what happens if the B's exports as seen at the
> time of building A are different form the actual exports of the
> version of B that is wired at runtime and from this point of view, I
> can see arguments pro and con (personally I think that this will be
> better overall but I can imagine that others may have a different
> opinion).
>
> Michal
I certainly like the simplicity; unfortunately, I don't think this will
work at runtime if I correctly understand what you proposed. :-(
Supposes module A imports modules B and C, and module B also imports and
re-exports module C. Using the expanded-export-list approach would cause
module A fail to initialize - the shallow validation could detect
duplicate types from the imported modules B and C but would be unable to
determine if the duplicate types were originated from the same module C.
Under the current algorithms in the updated specification, module A
would be initialized successfully, which is the correct behavior.
- Stanley
More information about the jsr277-eg-observer
mailing list