<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Josiah Noel" <josiahnoel@gmail.com><br><b>To: </b>"compiler-dev" <compiler-dev@openjdk.org><br><b>Sent: </b>Tuesday, April 8, 2025 4:12:16 AM<br><b>Subject: </b>Cannot find symbol when using the current module as an import<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div dir="ltr"><div>Hey team, </div><br><div>So I tried to modify some annotation processors to use the current module as an import to see if I could reduce the number of imports I have to generate. Unfortunately, it looks like when I use the current module as an import, it can't read the imports of its dependencies.</div><br><div>Suppose I have: </div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">module example { </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> requires com.fasterxml.jackson.databind; </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">}</blockquote><br><div>And I try:</div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">import module example; </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">class Example { </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> void main() { </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> var mapper = new ObjectMapper(); //Cannot find symbol</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> }</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">}</blockquote></div><br><div>It fails to import the object mapper class.</div></div></div></blockquote><div><br></div><div><br data-mce-bogus="1"></div><div>Hello,</div><div>the require inside the module example should be a require transitive.</div><div><br data-mce-bogus="1"></div><div>Now, please beware of import module, like an import *, those means that the list of types you are importing is unbounded and may change in the future (for example, if the module of jackson is updated), so your class Example may fail to compile in the future.</div><div><br data-mce-bogus="1"></div><div>import module is nice for demos or for beginners, but if you have an import module in your code, updating a dependency becomes a source incompatible change, that why most company have a policy against import *, and i suppose this policy will be updated soon to include import module, which is a kind of import * on steroid.<br></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div dir="ltr"><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Cheers, Josiah.</div></div><input name="virtru-metadata" type="hidden" value="{"email-policy":{"disableCopyPaste":false,"disablePrint":false,"disableForwarding":false,"enableNoauth":false,"expandedWatermarking":false,"expires":false,"sms":false,"expirationNum":1,"expirationUnit":"days","isManaged":false,"persistentProtection":false},"attachments":{},"compose-id":"1","compose-window":{"secure":false}}"></div>
</div></blockquote><div><br></div><div>regards,</div><div>Rémi</div><div><br data-mce-bogus="1"></div></div></div></body></html>