spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.5k stars 38.1k forks source link

Create well-known non-interface types in CollectionFactory without using reflection #28718

Closed wilkinsona closed 2 years ago

wilkinsona commented 2 years ago

Affects: 6.0

As discussed with @sdeleuze, it would be useful for native images if CollectionFactory could create instances of well-known non-interface collection types without using reflection. Aligning with the types that the factory creates for different interfaces, these well-known implementations could be LinkedHashSet, TreeSet, and ArrayList. Similar changes could be made for map creation as well.

jhoeller commented 2 years ago

We effectively do that for well-known interfaces types already but somehow missed to check for the corresponding implementation classes as well. I might revisit this for 5.3.x even since it's a generally worthwhile optimization.

sbrannen commented 2 years ago