Re: Annotation scanning with java 9 multi version jars

Mark Thomas

On 09/01/18 15:18, bitonti@... wrote:

Looking over the JEP238 and JavaDoc, the focus is on resource lookup.  I
don't see any behavior which distinguishes a class type resource from a
non-class type resource.  Once a resource is available in a JAR it never
goes away.  Once the resource of a member class is available at a MR
version, it remains available at all higher MR versions.

From a metadata perspective, I'm seeing mixed directions.  Metadata
which is provided beneath META-INF is fixed across all MR versions. 
But, module descriptors can be MR version specific.  Module "uses"
clauses can be MR version specific.  Then, does that imply a need to
handle different class paths for JavaEE modules -- which contradicts
that META-INF metadata is fixed?

From an annotation scanning perspective, the best I've determined is
that some annotations will be independent of MR version (probably
anything that can be mapped back to module descriptors, which live in
META-INF, and which is MR version independent), while other annotations
are tied to class details and will vary across MR versions (for example,
@Trivial, which WebSphere uses for dynamic trace injection.)  The
question that I have is whether any JavaEE active annotations would be
of the runtime type, meaning, allowed to vary by MR version.

I presume that WAR and RAR files, as specializations of JAR files,
automatically acquire the MR JAR behavior.
My starting position is the opposite.

The summary in JEP 238 starts:
"Extend the JAR file format to allow multiple, Java-release-specific
versions of class files to coexist in a single archive."

That says to me, multi-release features are intended only for classes.

Secondly, WAR files do not implement all the features of JARs. See the
glossary of the Servlet spec for some explicit examples.

Therefore, unless the behaviour is explicitly called out in the Servlet
spec my starting position is that a WAR file does not support it.


For WAR files there seem to
be questions about how exactly to map base resources to the MR version
specific locations, e.g., should "WEB-INF/classes" be discarded.  (A
simplistic extension of MR JAR function to WAR files would not be aware
of "WEB-INF" as a distinguished directory and would carry that into the
mapped MR version specific locations.)

Thomas Bitonti
IBM - WebSphere Application Server

Join to automatically receive all group messages.