Add new service types to AOT optimizations by default #812
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
And you would ask: why don't you use the constant available in
io.micronaut.aot.std.sourcegen.AbstractStaticServiceLoaderSourceGenerator
? Good question! That's because Micronaut AOT is a compile only dependency: we have the ability to override the version of AOT which is used at runtime, so the types that we use in the task are limited, and we cannot use any of the AOT types at this point in time.This means that ideally, we should have an additional AOT module which simply exposes such constants, and use it as a runtime dependency. However, it's a bit overkill for a single constant right now. Worse, this wouldn't improve the situation in case the user overrides the AOT version, since the plugin would only "see" the version it was compiled with. This means a proper fix would be to actually read the constant dynamically, before we invoke AOT. Lots of work for something which would slow down execution and be a bit hackish.