Skip to content

Consider ClassFile API for reading class metadata from bytecode #33616

Closed
@bclozel

Description

@bclozel

Spring Framework currently shades ASM for several features:

  1. bytecode generation with cglib
  2. 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

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions