This PR resolves https://github.com/spring-projects/spring-framework/issues/31400 (follow up).
It effectively reverts: - (1): https://github.com/spring-projects/spring-framework/commit/bf9f261b9512a3d0f84844dfa75943a231ed5a87 - (2): https://github.com/spring-projects/spring-framework/commit/5459304a4b5e8dc6ce08ff8d9e09228ab7d72659
(1)
This commit removed the support for cycling annotations, because it was assumed that Kotlin will no longer support them starting with 1.9.0
.
Kotlin only removed support for direct cycles. For example:
annotation class X(val value: X)
annotation class X1(val value: X2)
annotation class X2(val value: X1)
This code will not compile with >= 1.9.0
However, Kotlin did not remove support for indirect cycles. For example:
annotation class Y1(val value: Array<Y1>)
annotation class Y2(vararg val value: Y2)
annotation class Z1(val value: Z2)
annotation class Z2(val value: Array<Z1>)
annotation class Z3(val value: Z4)
annotation class Z4(vararg val value: Z3)
This code is valid and will compile, because the cycle includes an array.
(2)
This commit restored part of the recursive annotation support, but missed the nested cycles. Hence, the implementation is not sufficient to support Kotlin annotations.
Please note that this PR will not add any new logic, but only restores the implementation before https://github.com/spring-projects/spring-framework/commit/bf9f261b9512a3d0f84844dfa75943a231ed5a87
Comment From: pivotal-cla
@lorenzsimon Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-cla
@lorenzsimon Thank you for signing the Contributor License Agreement!
Comment From: jhoeller
Since we had the previous restoration attempts in 6.0.13, let's try to fix it for good in 6.0.14.
Comment From: sbrannen
This has been merged into main
and 6.0.x
.
Thanks 👍