-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce a Field type
in reflect-config.json
that Includes all Type's Metadata in the Image
#7962
Comments
type
in reflect-config.json
that Includes all Type's Metadata in the Image
This sounds like Furthermore, I don't see what's the motivation behind having the agent produce the At least I would expect the agent to have an option to choose between the two alternatives.
In Quarkus we would like to have the option to not include all class metadata in such cases, be it through keeping the current behavior or through a new option that will define the behavior.
Is this question specific to
No, if I get it right, this would prevent users, frameworks, and libraries from having finer control on their configuration.
Yes, that would be a good way to allow users to optimize their images. Starting with
Although an image size increase of ~5% may not sound dramatic, we have observed [1][2] such kind of increases in both 23.0 and 23.1. These kind of changes although small on their own, they end up adding up. As a result, we would prefer such kind of changes to be optional (either opt-in or opt-out) when they are not affecting correctness. [1] https://quarkus.io/blog/mandrel-23-0-image-size-increase/ |
I'd not include the constructors for invocation. I think the mental model should be: when using "type", everything can be queried, but if I want invocation, I need to explicitly opt-in into that. |
@zakkak thanks for your feedback, I will adjust the proposal according to some of the answers.
That is not decided and it very much depends on the community adoption. It seems strange that we will have two ways to achieve the same thing.
The goal is to shift the community to reason in terms of complete types. If the agent keeps producing the |
Thank you @vjovanov.
Sure, that makes sense as long as there is the option to exclude stuff from the type that was included via "type". Same goes for "It seems strange that we will have two ways to achieve the same thing.". As long as we can achieve the same behavior it's fine to deprecate and eventually remove |
From the conversation I understood it as if that happens then it would have negative impact on sizes and possible behaviors that's why it was suggested to leave out. For me I see "type" as a shorthand, not for just including everything from a type but a decent good first choice which we want the agent as well as users to be able to use as much as possible by default - but then allow overrides.
Yeah, the more I think about it treating "type" as shorthand for setting the default of the details but be able to still use the detailed flags would make sense.
Deprecate seems easy. Removal seems like very tricky. At what point would that be viable to consider? |
Great way to present the new feature. We all seem to agree that we need to keep the previous functionality.
We would have to analyze the dependencies on Maven and see how many people get impacted. I would not consider removal in the next 5 years. |
It looks like this was implemented in #8369. Are there any pending tasks on it? |
TL;DR
We'd like to include all the type's metadata for types that are registered for reflection as the default behavior in
reflect-config.json
. The newly included metadata would contain method signatures, inner classes, field metadata, record components, signers, and permitted subclasses. The transitively included classes would be included in the image, but not registered for reflection.This is inspired by #7753 where we show that roughly 25% of registration entries can be removed when we use the proposed approach here.
Since this is a breaking change, we propose a new schema for inclusion:
as this is anyhow required for proxies and lambdas. The new entry would be equivalent to
It should be possible to disable the metadata from a
type
by disabling certain properties. For example, we can exclude method metadata with:Since this change will propagate quickly through the ecosystem, we intend to backport this change to GraalVM for JDK 17 and JDK 21.
The format with
name
will be kept functional in the foreseeable future due to the number of existing projects that use it. However, the agent will be changed to produce the format withtype
.Goals
Non-Goals
Discussion points
Should
Class.forName("literal.Type")
include all class metadata in the image? Likely not, this would make the programming model unpredictable and bloat the image.Should we include the default constructors with the
type
? Likely not, although it would reduce the amount of metadata by 10%.When merging old and new configs, should the agent (or
native-image-configure
) subsume the previous config withtype
? This is necessary astype
is always stronger thanname
ortype
with some elements disabled.The text was updated successfully, but these errors were encountered: