RFR: 8305225: A service broken error despite annotation processor generating it if directives listed
Adam Sotona
asotona at openjdk.org
Fri Jun 2 14:04:05 UTC 2023
On Thu, 18 May 2023 13:21:08 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> Consider code like:
>
> module m {
> provides api.Api with impl.Impl; //impl.Impl is not in sources, but is generated by an annotation processor
> }
>
>
> This works fine, until the processor asks for the given module's directives, in which case the build fails with an error like:
>
> testCreateProvidesWithAP/src/m/module-info.java:2: error: the service implementation does not have a default constructor: Test
> provides api.Api with test.Test;
>
>
> The cause for this error is that when the directive is analyzed, the `test.Test` is attributed (and any errors from that are delayed due to the annotation processing), but even though it attributes to an erroneous type, it will still be checked whether it has the appropriate constructor, etc.
>
> The proposal is to skip the additional checks when the type is an erroneous type. Errors for it should have been reported and handled appropriately (i.e. ignored if resolved by an AP, or reported if not), there does not seem to be any reason to produce any further errors related to the missing type.
It looks good 👍
-------------
Marked as reviewed by asotona (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14046#pullrequestreview-1457554605
More information about the compiler-dev
mailing list