-
Notifications
You must be signed in to change notification settings - Fork 38.1k
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
AnnotationScanner scanning leads to StackOverflowError with recursive annotation #31400
Comments
Is there any workaround like ignoring the annotation? |
I'm afraid there isn't an obvious workaround. We'll have to address this in our Note that Java annotations are not allowed to refer to themselves in their attributes, so this remains Kotlin specific. Kotlin prohibits deep cycles (X -> Y -> X) in annotation declarations as of Kotlin 1.9 (aligned with Java) but still allows self references (in contrast to Java)... unfortunately we missed the latter part there. |
@jhoeller The fix does not work for the following legal Kotlin code:
see the externalMap property. Can Spring add support for this valid use-case please 🙏 This is my use-case: https://github.com/OpenFolder/kotlin-asyncapi/blob/master/kotlin-asyncapi-annotation/src/main/kotlin/org/openfolder/kotlinasyncapi/annotation/Schema.kt |
This commit reinstates support for recursive annotations in Kotlin. See spring-projectsgh-28012 See spring-projectsgh-28618 See spring-projectsgh-31400 Closes spring-projectsgh-31518
Affects: 6.0.12
I am trying to update from Spring boot 2.7.13 to 3.1.4.
We are using this custom annotation to document configuration properties.
When I run the app, it fails:
I've epxlored what happens, and the issue is that method
org.springframework.core.annotation.AnnotationTypeMapping#computeSynthesizableFlag
finds thechildren
property of ourDocProperty
class annotation and calls theforAnnotationType
, with thechildren
's type which isDocProperty
again. And that's infinite loop.It's reproducible here: tolgee/tolgee-platform@259cd31 (the specific commit)
The text was updated successfully, but these errors were encountered: