Spring Framework 6 added support for AOT generation of CGLIB proxies via #28115. We were able to remove a bunch of reachable classes from the reachable code path via #29521, but some CGLIB classes are still reachable via CglibSubclassingInstantiationStrategy
, CglibAopProxy
, and ObjenesisCglibAopProxy
:
org.springframework.cglib.core.AbstractClassGenerator
org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData
org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$1
org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$2
org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3
org.springframework.cglib.core.ClassLoaderAwareGeneratorStrategy
org.springframework.cglib.core.CodeGenerationException
org.springframework.cglib.core.CollectionUtils
org.springframework.cglib.core.Constants
org.springframework.cglib.core.DefaultNamingPolicy
org.springframework.cglib.core.ReflectUtils
org.springframework.cglib.core.Signature
org.springframework.cglib.core.SpringNamingPolicy
org.springframework.cglib.core.TypeUtils
org.springframework.cglib.core.WeakCacheKey
org.springframework.cglib.core.internal.LoadingCache
org.springframework.cglib.core.internal.LoadingCache$2
org.springframework.cglib.proxy.CallbackInfo
org.springframework.cglib.proxy.DispatcherGenerator
org.springframework.cglib.proxy.Enhancer
org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData
org.springframework.cglib.proxy.Enhancer$EnhancerKey
org.springframework.cglib.proxy.FixedValueGenerator
org.springframework.cglib.proxy.InvocationHandlerGenerator
org.springframework.cglib.proxy.LazyLoaderGenerator
org.springframework.cglib.proxy.MethodInterceptorGenerator
org.springframework.cglib.proxy.MethodProxy
org.springframework.cglib.proxy.MethodProxy$CreateInfo
org.springframework.cglib.reflect.FastClass$Generator
The purpose of this issue is to explore how to reduce as much as possible those reachable types (first goal is to reduce the memory footprint on native) when running in AOT mode. Would a dedicated InstantiationStrategy
make sense at runtime in AOT mode for example?
Note that this might not be straightforward due to the need to initialize and configure the proxy classes, which in turn involves CGLIB-specific types, but it's likely worth a try.