Uses directive not visible in annotation processor when provider class not existing (yet)
Jan Lahoda
jan.lahoda at oracle.com
Thu Dec 1 15:45:53 UTC 2022
Hi Michal,
The provides directive returns TypeElement as the service and a list of
TypeElements as the implementations, and I don't think we can reasonably
model non-existing types as TypeElements (normally missing types are
modeled as erroneous TypeMirrors, I believe). So, having the
non-existent implementation listed in the directive is probably
difficult. Currently, when there are no implementations, the directive
is skipped altogether - it might be possible to change that, although I
am not sure if that would be helpful (as the non-existent type would not
be in the directive anyway).
Overall, I wonder how exactly is this meant to work. Using the
(javac-specific) AST, one could get the (qualified) name that refers to
the type that does not exist, but that may be a simple name, and depend
on an import, so the correct FQN must be inferable somehow?
Thanks,
Jan
On 01. 12. 22 9:24, Michał Kłeczek wrote:
> Hi,
>
> I am implementing an annotation processor that (among other things) is
> supposed to generate service provider classes that delegate calls to
> beans from a Spring application context.
>
> The idea is to mark a module in module-info with an annotation and add
> “provides Service with Implementation” where Implementation is not
> existent (yet).
> Unfortunately it seems ModuleElement.getDirectives() does not return
> such a provides directive.
>
> Is it a bug or I am missing something?
>
> Thanks,
> Michal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20221201/fae6d8fb/attachment.htm>
More information about the compiler-dev
mailing list