Scanning Modules(take 2)?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Scanning Modules(take 2)?

Greg Wilkins
Back in September I asked a couple of questions about scanning modules (for
annotated classes):

http://mail.openjdk.java.net/pipermail/jigsaw-dev/2017-September/013178.html

Thanks for the answers, which have been helpful, but now a supplementary
question/suggestion.

Given that many java technologies (not just EE) need to scan jars for
annotated classes, is it possible for this to be a semantic provided by the
module system?  Currently multiple  java frameworks are implementing code
that asks for lists of modules, then lists of classes within those modules,
then finding the raw bytes of those classes and passing them to something
like ASM to determine how they are annotated in order to drive their
configuration.  This code can be rather complex and probably fragile when
you consider issues like:

   - multi release jars (specially as sometimes one JVM might need to
   process meta data to be deployed on a different java platform)
   - classpath vs module path vs upgrade paths etc
   - observable vs resolved vs platform modules
   - layers
   - jlink


Currently frameworks are having to reimplement much of the logic to
determine exactly what classes a JVM will resolve for a given environment.
The chances are low of every frameworks getting this right and doing so in
a way that is future proof as these features evolve through java 9, 10, 11.

So perhaps it would be a good idea for the library to provide some
semantics to assist frameworks to get this right?  Ideally there would be
an API to allow frameworks to query the JVM about what classes (which may
not be loaded and may even be for a different target platform) it can see
that are annotated in a particular way.

thoughts?


--
Greg Wilkins <[hidden email]> CTO http://webtide.com
Reply | Threaded
Open this post in threaded view
|

Re: Scanning Modules(take 2)?

Alan Bateman
On 29/11/2017 09:33, Greg Wilkins wrote:
> :
>
> So perhaps it would be a good idea for the library to provide some
> semantics to assist frameworks to get this right?  Ideally there would be
> an API to allow frameworks to query the JVM about what classes (which may
> not be loaded and may even be for a different target platform) it can see
> that are annotated in a particular way.
>
This was listed in the JSR 376 requirements document [1] but it didn't
happen in Java SE 9. There were suggestions at the time to generate an
index at packaging time. There were also suggestions (and some initial
prototyping with a jlink plugin) to index at link time. I don't think
the efforts got as far as thinking about an API.

So yes, it is an area where there is interest but I'm not aware of
anyone working on it just now. If you or others have cycles to create a
library and explore the area then it could be useful.

-Alan

[1]
http://openjdk.java.net/projects/jigsaw/spec/reqs/#efficient-annotation-detection 

Reply | Threaded
Open this post in threaded view
|

Re: Scanning Modules(take 2)?

Greg Wilkins
Alan,

good to know that there is at least interest and intent to help out with
this complex task.

Not so sure we have a lot of cycles,  but the eclipse jetty project is
already burning cycles now to implement, so in the long run it may be
better to put in a few more cycles to make this logic generally accepted.

I'm wondering if perhaps I should suggest as a new project within the
eclipse EE4J effort, as that will capture interest, expertise and cycles
from several frameworks that could benefit.   If successful, it might then
live there long term, but I think contribution to a future java platform
would be a better home for it as it would benefit from being part of future
considerations.

Unless anybody has a better suggestion of where such an effort could be
coordinated, I'll take this suggestion to eclipse EE4J.

cheers




On 29 November 2017 at 11:01, Alan Bateman <[hidden email]> wrote:

> On 29/11/2017 09:33, Greg Wilkins wrote:
>
>> :
>>
>> So perhaps it would be a good idea for the library to provide some
>> semantics to assist frameworks to get this right?  Ideally there would be
>> an API to allow frameworks to query the JVM about what classes (which may
>> not be loaded and may even be for a different target platform) it can see
>> that are annotated in a particular way.
>>
>> This was listed in the JSR 376 requirements document [1] but it didn't
> happen in Java SE 9. There were suggestions at the time to generate an
> index at packaging time. There were also suggestions (and some initial
> prototyping with a jlink plugin) to index at link time. I don't think the
> efforts got as far as thinking about an API.
>
> So yes, it is an area where there is interest but I'm not aware of anyone
> working on it just now. If you or others have cycles to create a library
> and explore the area then it could be useful.
>
> -Alan
>
> [1] http://openjdk.java.net/projects/jigsaw/spec/reqs/#efficient
> -annotation-detection
>



--
Greg Wilkins <[hidden email]> CTO http://webtide.com