<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<blockquote type="cite" cite="mid:CH0PR10MB51006744C4F05C3C19FCBB06FA702@CH0PR10MB5100.namprd10.prod.outlook.com">
<div class="elementToProof"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><b>Ad
2 - Provider module cannot be optional dependency</b></span></div>
<div class="elementToProof"><span style="letter-spacing: normal; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-weight: 400;">-------------------------------------</span></div>
<div><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Problem:
We cannot declare `requires static` on a module that has the
ServiceLoader provider interface (or abstract class)</span></div>
</blockquote>
<p>Note that there was a relative long discussion about this exact
topic in April 2023:</p>
<p><a class="moz-txt-link-freetext" href="https://mail.openjdk.org/pipermail/jigsaw-dev/2023-April/014846.html">https://mail.openjdk.org/pipermail/jigsaw-dev/2023-April/014846.html</a></p>
<p>I personally think that the current implementation is too
restrictive as I see very little gain in this runtime error, but
there was also a noticeable opposition.<br>
</p>
<blockquote type="cite" cite="mid:CH0PR10MB51006744C4F05C3C19FCBB06FA702@CH0PR10MB5100.namprd10.prod.outlook.com"><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><b>Ad
4 - Duality of definition between classpath and module path</b></span>
<div class="elementToProof"><span style="letter-spacing: normal; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 16px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-weight: 400;">-------------------------------------</span></div>
<div><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Problem:
To support services, we MUST declare them twice - once in
`provides` in module-info.java, once through META-INF/services</span></div>
<div><span style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">Possible
solution: Java could read module descriptors even when running
in classpath mode to add service implementations and merge it
with META-INF/services information</span></div>
</blockquote>
<p>While I did also run into this issue, I would favor a solution
during the build phase. Maybe some project still uses Java 8,
where the JDK does not yet know about the module-info. The
behavior should not change between different versions of the
runtime.</p>
<p>PS: I am not affiliated with the project, besides being
subscribed to this mailing list.</p>
</body>
</html>