You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
Refine default access attribute defined on @TypeHint #1123
Given int access() default AccessBits.LOAD_AND_CONSTRUCT; it should be the same but the code in org.springframework.nativex.type.Type#unpackTypeHint seems to work differently when the attribute is defined or not.
This is not a mistake but was it some lingering design we should tidy up. Originally people had no real clue about what to set for visibility on their types and there were lots of different kinds to consider (configurations, listeners, processors, selectors, registrars, regular types, array types) - so we never default back to the default access value on the TypeHint annotation. Instead we used Type#inferAccessRequired(Type) if they didn't provide a value. This enabled us to be smarter (for example, adding more than CLASS access for an array type is meaningless so the default isn't quite right in that case anyway - for different kinds of types the default is really different - annotation types, enum types, array types, etc).
With Aot we have simplified inferAccessRequired and it doesn't get called for a variety of Springy things it used to. I just experimented with letting it default and ran all the samples. I was still concerned that there might be hints still relying on the smarts, rather than the defaulting. And, yes, around 25 samples start failing if you just let it default.
I think we should fix up the hints to be correct, even perhaps not have a default, it's easier now there are fewer and they aren't full of Spring stuff. However, up to you whether we want to tackle that before/after M1. It means revisiting all the failing samples and working out what is wrong with the hints. I added some simple diagnostics that can come up with what is being inferred differently to the default, it tells me 1762 of the types referred to in type hints across all native hints are smartly inferred to be something different to the default - that doesn't mean the inferred thing is always 100% correct of course, it just means it is much more compatible (it may still be overkill and less access is possible). I'm tempted to get M1 out on our somewhat stable setup then tackle things like this.
changed the title [-]Wrong reflect-config.json generated with no `access` attribute defined on `@TypeHint`[/-][+]Refine default `access` attribute defined on `@TypeHint`[/+]on Oct 26, 2021
Activity
aclement commentedon Oct 3, 2021
This is not a mistake but was it some lingering design we should tidy up. Originally people had no real clue about what to set for visibility on their types and there were lots of different kinds to consider (configurations, listeners, processors, selectors, registrars, regular types, array types) - so we never default back to the default access value on the TypeHint annotation. Instead we used
Type#inferAccessRequired(Type)if they didn't provide a value. This enabled us to be smarter (for example, adding more thanCLASSaccess for an array type is meaningless so the default isn't quite right in that case anyway - for different kinds of types the default is really different - annotation types, enum types, array types, etc).With Aot we have simplified inferAccessRequired and it doesn't get called for a variety of Springy things it used to. I just experimented with letting it default and ran all the samples. I was still concerned that there might be hints still relying on the smarts, rather than the defaulting. And, yes, around 25 samples start failing if you just let it default.
I think we should fix up the hints to be correct, even perhaps not have a default, it's easier now there are fewer and they aren't full of Spring stuff. However, up to you whether we want to tackle that before/after M1. It means revisiting all the failing samples and working out what is wrong with the hints. I added some simple diagnostics that can come up with what is being inferred differently to the default, it tells me 1762 of the types referred to in type hints across all native hints are smartly inferred to be something different to the default - that doesn't mean the inferred thing is always 100% correct of course, it just means it is much more compatible (it may still be overkill and less access is possible). I'm tempted to get M1 out on our somewhat stable setup then tackle things like this.
aclement commentedon Oct 3, 2021
This commit aclement@f6b035e turns on diagnostics and lets them default. (Have to search for MISMATCH in the
target/native/output.txt)sdeleuze commentedon Oct 4, 2021
Ok let's tackle that post M1.
[-]Wrong reflect-config.json generated with no `access` attribute defined on `@TypeHint`[/-][+]Refine default `access` attribute defined on `@TypeHint`[/+]sdeleuze commentedon Nov 10, 2021
Working on it, should have something shortly.
Refine default access attribute defined on @typehint