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

StackOverflowError with th entity framework? #313

Open
hrstoyanov opened this issue Oct 19, 2024 · 1 comment
Open

StackOverflowError with th entity framework? #313

hrstoyanov opened this issue Oct 19, 2024 · 1 comment

Comments

@hrstoyanov
Copy link

hrstoyanov commented Oct 19, 2024

Environment Details

  • EclipseStore Version: 2.0.0
  • JDK version: 22
  • OS: macos
  • Used frameworks: irrelevant

Describe the bug

Consider the following ES code of two entities pointing to each other:

public interface Email extends Entity {
  User user();
}
public interface User extends Entity {
   List<Email> emails();
}

Currently the entity code generator will generate toString() to entities and data object that end up using the (also generated) UserAppendable and EmailAppendable objects, both of which have a generated method:

public VarString appendTo(VarString vs) {...}

However, if you look carefully at the generated appendTo code, it leads to infinite recursion, if for some reason one calls the toString() method on an entity or data object! This is particularly annoying in the IntelliJ debugger, as it wants to convert objects to strings for display purposes, steping through the code, leading to very slow debugging, since at each step it generates StackOverflow exception due to the infinite recursion cause by toString().

@hrstoyanov
Copy link
Author

Perhaps the best approach is to make toString() in generated code optional, disabled by default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant