Unsafe invocation of .value() on annotations in SynthesizedMergedAnnotationInvocationHandler prevents backwards-compatible additions to @annotation interfaces #24029
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: regression
A bug that is also a regression
Milestone
Context
I have a scenario where I am extending an annotation API from
to
Here, old libraries compiled with the old annotation are still supported as the change is binary compatible. It is only that I as a framework author need to handle the case of an invocation of value() throwing an
IncompleteAnnotationException
.I believe allowing this is crucial to evolution of annotations without forcing all implementors to re-compile.
Issue in Spring Core
When calling
org.springframework.beans.factory.ListableBeanFactory#findAnnotationOnBean
, Spring tries to build a proxy for the found annotation. In the process, spring attempts to load the value of all annotation attributes viaorg.springframework.core.annotation.SynthesizedMergedAnnotationInvocationHandler#getAttributeValue
. This fails for the newly added annotation attribute as mentioned above:Here, I believe the implementation should not expected values to be complete. I am not even sure as to why
org.springframework.core.annotation.SynthesizedMergedAnnotationInvocationHandler#SynthesizedMergedAnnotationInvocationHandler
loads the values in the first place.The text was updated successfully, but these errors were encountered: