Ever thought of a ModuleElement Query function?
Josiah Noel
josiahnoel at gmail.com
Tue Sep 12 18:48:45 UTC 2023
I got that, I'm just wondering if there is a more efficient way to go about
it, as that would involve several levels of nested iteration depending on
the project. (since you need to examine the requires directives of every
module and each of their modules and so on)
On Tue, Sep 12, 2023 at 2:24 PM Jonathan Gibbons <
jonathan.gibbons at oracle.com> wrote:
> 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).
>
>
> https://docs.oracle.com/en/java/javase/20/docs/api/java.compiler/javax/lang/model/element/ModuleElement.html#getDirectives()
>
> -- Jon
>
>
> On 9/11/23 9:51 PM, Josiah Noel wrote:
>
> Hello there,
>
> 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.
>
> 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)
>
> --
> Cheers, Josiah.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20230912/b92346fe/attachment.htm>
More information about the compiler-dev
mailing list