<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>To find whether a project's ModuleElement contains a certain
dependency, you can (recursively) examine the directives (in
particular, the RequiresDirective) for the module(s).</p>
<p><a class="moz-txt-link-freetext" href="https://docs.oracle.com/en/java/javase/20/docs/api/java.compiler/javax/lang/model/element/ModuleElement.html#getDirectives()">https://docs.oracle.com/en/java/javase/20/docs/api/java.compiler/javax/lang/model/element/ModuleElement.html#getDirectives()</a></p>
<p>-- Jon<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 9/11/23 9:51 PM, Josiah Noel wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAJ_t5UZRfxEtzr8_U-o1FzcoP55JD8PgxeL-jfz9HN4RM71X_g@mail.gmail.com">
<div dir="ltr"> Hello there,
<div><br>
</div>
<div>I think it would be nice if a sort of query method was
added to ModuleElement such that one can see if a certain
module is on its graph. <br>
</div>
<div><br>
</div>
<div>I want to add functionality to my annotation processor that
should check whether a project's ModuleElement contains a
certain dependency. Currently, I'm thinking I'll need to
recursively iterate over the directives to search the module
path. (which naturally gets much slower the more modules are
involved) </div>
<div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature" data-smartmail="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>
</body>
</html>