<br><font size=2 face="sans-serif">Hi Stanley</font>
<br>
<br><font size=1 face="sans-serif"><b>&quot;Stanley M. Ho&quot; &lt;stanley.ho@SUN.COM&gt;</b></font><tt><font size=2>
wrote on 16/05/2007 07:39:10:<br>
<br>
&gt; Hi JSR 277 experts,<br>
&gt; <br>
&gt; This is regarding the semantic of legacy classes in a module, and
is one of<br>
&gt; the outstanding issues in the updated specification (Section 2.14)
that I<br>
&gt; would like to get your inputs.<br>
&gt; <br>
&gt; Typically, classes in a module are &quot;module&quot; classes - Java
classes that have<br>
&gt; superpackage membership. However, it is also possible that developers
may<br>
&gt; want to make use of legacy classes in a module, e.g. using an existing
xml<br>
&gt; parser in a module. There are two possible use cases I can think of:</font></tt>
<br>
<br><tt><font size=2>I can't tell from this whether the developer has the
freedom to recompile the legacy classes, but I assume not otherwise it
would be trivial to include them as superpackage members. (Also, there
are use cases where a developer needs to use an existing JAR, but doesn't
have the source or the rights to crack the JAR open and fiddle with the
contents.)</font></tt>
<br><tt><font size=2><br>
&gt; <br>
&gt; 1. Developers simply make use of the legacy classes as implementation<br>
&gt; details in the module. In this case, the exported module classes neither<br>
&gt; expose nor reference the legacy classes in the export signatures,
and the<br>
&gt; legacy classes in the module should not be made visible to the importing<br>
&gt; modules.<br>
&gt; <br>
&gt; 2. Developers use the legacy classes as part of the public API in
the<br>
&gt; module. In this case, the legacy classes in the module should be made<br>
&gt; visible to the importing modules. The exported module classes may
expose or<br>
&gt; reference the legacy classes in the export signatures, but this is
<br>
&gt; not required.<br>
&gt; <br>
&gt; I think it's important for us to recognize and support both use cases.<br>
&gt; However, this may be difficult for us to determine which use case
is the<br>
&gt; developers' real intention. Adding to the mix is that lack of module
level<br>
&gt; access control for the legacy classes, and there is not much we can
do once<br>
&gt; the legacy classes are leaked out from the module classloader.<br>
&gt; <br>
&gt; That said, I think it's still important for us to define the semantics
for<br>
&gt; both use cases in the specification. Here is what I propose:<br>
&gt; <br>
&gt; a. Consider #1 to be the default.</font></tt>
<br>
<br><tt><font size=2>Agreed.</font></tt>
<br><tt><font size=2><br>
&gt; b. Add a new superpackage-level annotation (e.g. @ExportLegacyClasses)
for<br>
&gt; developers to indicate the module is in the #2 category.</font></tt>
<br>
<br><tt><font size=2>Note that this does not enable a developer to expose
some but not all of the legacy classes in a module.</font></tt>
<br><tt><font size=2><br>
&gt; c. If @ExportLegacyClasses is declared, the<br>
&gt; ModuleDefinition.getExportedClasses() would include the legacy classes.<br>
&gt; <br>
&gt; Note that unless this annotation is declared in the module definition,
the<br>
&gt; importing modules will never attempt to load the legacy classes from
the<br>
&gt; imported module during classloading delegation as the classloading<br>
&gt; delegation algorithm always checks getExportedClassed() first (see
algorithm<br>
&gt; in 7.3.1, step 4). However, if other code obtains a reference of the
module<br>
&gt; classloader somehow and invokes loadClass() directly with the legacy
class<br>
&gt; name, the module classloader will still return the legacy class, and
this is<br>
&gt; consistent with the existing classloader behavior.</font></tt>
<br>
<br><tt><font size=2>Is this proposal meant to include the case of creating
a module from legacy classes alone? If so, I guess the module would need
an 'empty' superpackage definition such as:</font></tt>
<br>
<br><tt><font size=2>@Version(&quot;2.9.0&quot;)</font></tt>
<br><tt><font size=2>@ExportLegacyClasses</font></tt>
<br><tt><font size=2>superpackage org.apache.xerces {}</font></tt>
<br>
<br><tt><font size=2>&gt; <br>
&gt; Let me know if you have inputs. If there are better ways to deal with
this<br>
&gt; issue, I would like to hear them as well.<br>
&gt; <br>
&gt; - Stanley<br>
&gt; <br>
&gt; P.S. This is also a repost due to email problems. Please ignore if
you<br>
&gt; receive more than one copy of this message.</font></tt>
<br>
<br><tt><font size=2>Glyn<br>
</font></tt><font size=3 face="sans-serif"><br>
</font>
<br><font size=3 face="sans-serif"><br>
</font>
<hr><font size=2 face="sans-serif"><br>
<i><br>
</i></font>
<p><font size=2 face="sans-serif"><i>Unless stated otherwise above:<br>
IBM United Kingdom Limited - Registered in England and Wales with number
741598. <br>
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU</i></font>
<p><font size=2 face="sans-serif"><br>
</font><font size=3 face="sans-serif"><br>
</font>
<br>
<br><font size=3 face="sans-serif"><br>
</font>