Description
Spring Framework currently shades ASM for several features:
- bytecode generation with cglib
- reading class metadata from bytecode
Our usage of ASM is not a problem these days and we tend to allow use of up-to-date JDK versions in Spring apps thanks to swift upgrades of our shaded version. Still, we should consider our options with the new ClassFile API.
Spring Framework maintains two implementations of metadata reading: one based on Class
reflection (org.springframework.core.type.StandardClassMetadata
) and another one based on bytecode reading with ASM (org.springframework.core.type.classreading.SimpleMetadataReaderFactory
). This API does not expose any ASM type and is a good use case for the ClassFile API.
The ClassFile API JEP 457 is currently in preview mode but should be out of preview for JDK 24.
With this issue, we should:
- prototype an implementation variant of
SimpleMetadataReaderFactory
based on ClassFile - consider how this variant should be involved. As a feature flag only? Should it be the default on JDK24+?
- decide which Spring Framework version we should target; while not user facing, this is an important change that we should schedule accordingly