Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore support for recursive annotations in Kotlin #31518

Closed
wants to merge 1 commit into from

Conversation

lorenzsimon
Copy link
Contributor

@lorenzsimon lorenzsimon commented Oct 29, 2023

This PR resolves #31400 (follow up).

It effectively reverts:

(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 bf9f261

This commit brings back the support for cycling annotations in Kotlin
@pivotal-cla
Copy link

@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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 29, 2023
@pivotal-cla
Copy link

@lorenzsimon Thank you for signing the Contributor License Agreement!

@sbrannen sbrannen changed the title Restore support for recursive annotations Restore support for recursive annotations in Kotlin Oct 29, 2023
@sbrannen sbrannen added type: regression A bug that is also a regression in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 29, 2023
@sbrannen sbrannen added this to the 6.1.0 milestone Oct 29, 2023
@jhoeller jhoeller modified the milestones: 6.1.0, 6.0.14 Oct 30, 2023
@jhoeller
Copy link
Contributor

Since we had the previous restoration attempts in 6.0.13, let's try to fix it for good in 6.0.14.

@sbrannen sbrannen self-assigned this Oct 30, 2023
@sbrannen sbrannen closed this in 6a7a0bd Nov 8, 2023
@sbrannen
Copy link
Member

sbrannen commented Nov 8, 2023

This has been merged into main and 6.0.x.

Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AnnotationScanner scanning leads to StackOverflowError with recursive annotation
5 participants