<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Ad 1 (</span><span style="font-family: "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">provider
implementations cannot be code generated without major problems</span><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">) </span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">I understand that annotation processing should not mutate elements, and I never suggested
it should be done. I am looking for a solution provided by the language (whatever that may be).</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">I am not sure if you are aware of the complexity of the proposed "</span><span style="font-family: "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">It's
on the framework to post-process</span></div>
<div class="elementToProof"><span style="font-family: "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">module-info.class
so it has `provides` clauses</span><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">"</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Considering that we currently have multiple build frameworks, and for each of those
the postprocessing must be done differently, we are also opening the possibility of the user not configuring the postprocessing to happen at all. Just the first part (Maven plugins, Gradle plugins, possible other systems) is a major maintenance issue.</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">In addition, the compiled code deployed with the application differs from its source
code, making troubleshooting more complicated.</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">I understand it is easy to dismiss these problems and let us (as framework owners) handle
it. You are in the end forcing us to do it differently for each framework - which in the end is a problem for our users.</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">The result that other frameworks reached (and I was trying not to do), and we will switch
to as well, is to design our own extensibility approach that is based on resources rather than on module-info.java. This makes it once again harder for users, as they cannot use the tools the language provides.</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Pushing us to post-processing the bytecode: if there was an event in the compiler with
extensibility similar to annotation processors (i.e. ClassPostProcessor) using the ClassFile API, I can imagine this being done, as it is still part of a single compilation run (but as far as I know, there is no such possibility).</span></div>
<div id="appendonsend"></div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Ad 2 (requires static on provider module)</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
As far as I have seen the analysis of current Maven repository, Helidon is the only bigger framework that has embraced modularization. </div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
So "a large number of users" will not find the current rules unworkable, as there is not "a large number of users" using JPMS.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
As one of the users of it on a larger scale, I can tell you this is a major restriction for using JPMS together with ServiceLoader (and as mentioned above, we will stop using ServiceLoader because of this).</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Ad 3 (public provider)</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I understand this is not a critical feature</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Ad 4 (duality between module path and classpath)</div>
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">You have mentioned "</span><span style="font-family: "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">It's
relatively low risk, but also low reward, so we aren't going to investigate it further.</span><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">"</span></div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Once again I am not sure whose "low reward" you have in mind. I understand that in the language and for language developers this may not mean much. But for the users, frameworks etc. this is quite a big thing - we are now required to do another post-processing
of our libraries to ensure we have both (module-info provides and META-INF/services). </div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The reward is that new libraries can work both on classpath and on module path. And considering how many people use JPMS, this is quite a critical behavior for anything we create.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Tomas</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display: inline-block; width: 98%;">
<div dir="ltr" id="divRplyFwdMsg"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>Od:</b> jigsaw-dev <jigsaw-dev-retn@openjdk.org> za uživatele Alex Buckley <alex.buckley@oracle.com><br>
<b>Odesláno:</b> úterý 30. ledna 2024 20:05<br>
<b>Komu:</b> jigsaw-dev <jigsaw-dev@openjdk.java.net><br>
<b>Předmět:</b> Re: Java extensibility and JPMS (ServiceLoader)</span>
<div> </div>
</div>
<div><span style="font-size: 11pt;">On 1/19/2024 5:02 AM, Tomas Langer wrote:<br>
> Helidon currently has around 300 modules with module-info.java. In<br>
> general, this has improved our module structure and design.<br>
> Yet, we are now encountering some major issues related to extensibility.<br>
> I will put down a few points that are problematic, and explain each in<br>
> detail further in the e-mail (it is quite long, sorry about that).<br>
><br>
> 1. provider implementations cannot be code generated without major problems<br>
<br>
Annotation processing is designed to avoid mutating the elements, so it<br>
would be a fundamental change to allow mutation of module elements in<br>
the annotation processing API. It's on the framework to post-process<br>
module-info.class so it has `provides` clauses. The framework can use<br>
the ClassFile API to do this.<br>
<br>
It's not "weird" for a framework to modify module-info.class to ensure<br>
that code in the module has the right execution environment. Another<br>
example would be a tool that injects calls to a logging API into user<br>
code, then has to post-process module-info.class to add `requires<br>
logging.lib;`.<br>
<br>
> 2. the provider interface module MUST be on module path, even if it<br>
> could have `requires static`<br>
<br>
Relaxing module resolution to allow a module to `provides` an interface<br>
that it can't access is do-able, but the implications are unknown. It<br>
would be unfortunate if resolution succeeded but then unforeseen<br>
exceptions occur when faraway code tries to access the missing<br>
interface. We'll leave JDK-8299504 open for now, but we would need<br>
evidence that a large number of users are finding the current rules<br>
unworkable before actively looking at `provides` again.<br>
<br>
> 3. the provider implementation must be public with public constructor<br>
> 4. duality of definition between module path and class path<br>
<br>
These requests for ServiceLoader to (i) support package-private<br>
providers and (ii) inspect module-info.class files for `provides`<br>
clauses in JARs on the classpath both stem from insisting that modular<br>
JARs can be deployed on the classpath without losing functionality. This<br>
is a net-new requirement on the module system. It's relatively low risk,<br>
but also low reward, so we aren't going to investigate it further.<br>
<br>
Alex</span></div>
</body>
</html>