Integrated: 8305225: A service broken error despite annotation processor generating it if directives listed
Jan Lahoda
jlahoda at openjdk.org
Mon Jun 5 06:34:16 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.
This pull request has now been integrated.
Changeset: b6c9232b
Author: Jan Lahoda <jlahoda at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/b6c9232b8b2010e360abfba6f0d294dc27187911
Stats: 94 lines in 2 files changed: 91 ins; 0 del; 3 mod
8305225: A service broken error despite annotation processor generating it if directives listed
Reviewed-by: asotona
-------------
PR: https://git.openjdk.org/jdk/pull/14046
More information about the compiler-dev
mailing list