Skip to content

StackOverflowError when using BindingReflectionHintsRegistrar #28683

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

Closed
mhalbritter opened this issue Jun 23, 2022 · 2 comments
Closed

StackOverflowError when using BindingReflectionHintsRegistrar #28683

mhalbritter opened this issue Jun 23, 2022 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@mhalbritter
Copy link
Contributor

Minimal reproducer:

import org.springframework.hateoas.CollectionModel;

public static void main(String[] args) {
  BindingReflectionHintsRegistrar reflectionHintsRegistrar = new BindingReflectionHintsRegistrar();
  ReflectionHints reflectionHints = new ReflectionHints();
  reflectionHintsRegistrar.registerReflectionHints(reflectionHints, CollectionModel.class);
}

It looks like the ResolvableType in the CollectionModel1 is the problem, as this crashes too:

reflectionHintsRegistrar.registerReflectionHints(reflectionHints, ResolvableType.class);
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 23, 2022
@mhalbritter
Copy link
Contributor Author

mhalbritter commented Jun 23, 2022

The same happens with the org.springframework.integration.IntegrationPatternType type.

There's no ResolvableType involved, but the type references itself (with a type in between the cycle).

@mhalbritter mhalbritter changed the title StackOverflowError when using BindingReflectionHintsRegistrar with reachable ResolvableType StackOverflowError when using BindingReflectionHintsRegistrar Jun 23, 2022
@mhalbritter
Copy link
Contributor Author

mhalbritter commented Jun 23, 2022

It seems the cycle detection is broken:

public class Bar {
  public Bar getBar() {
    return null;
  }
}

throws an Exception too.

@sdeleuze sdeleuze self-assigned this Jun 23, 2022
@sdeleuze sdeleuze added type: bug A general bug 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 Jun 23, 2022
@sdeleuze sdeleuze added this to the 6.0.0-M5 milestone Jun 23, 2022
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Jun 23, 2022
This commit fixes the cycle detection in
BindingReflectionHintsRegistrar.

See spring-projectsgh-28683
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Jun 24, 2022
This commit refines BindingReflectionHintsRegistrar to handle
correctly a use case with multiple levels of nested generics.

Closes spring-projectsgh-28683
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Jun 27, 2022
This commit prevents a StackOverflowError in
BindingReflectionHintsRegistrar when processing enum types
and refine related generated hints.

See spring-projectsgh-28683
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Jun 27, 2022
This commit splits registerReflectionHints in multiple
methods.

See spring-projectsgh-28683
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: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants