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

Avoid endless Class Parameter Argument scanning, if the parameter Object contains a circular reference (e.g. bi directional relation within a bean) #177

Open
Syntobe opened this issue Aug 30, 2021 · 0 comments

Comments

@Syntobe
Copy link

Syntobe commented Aug 30, 2021

If a bean contains a circular reference, the DefaultModelDependencyProvider will never end with a scan of the parameter, due to endless looping over the entity.

i can submit a feature / bug fix for that if i get the rights. the additions for DefaultModelDependencyProvider are very easy.

once you track complex types as well,

private boolean isComplexType(ModelContext modelContext) {
return !isBaseType(modelContext);
}

you can simply avoid endless scans by adding a check, if the complex type has been processed within the current context:

// TODO: one should mark not only base types, but rather complex types as well, since you will benefit from the recursion break with back referenced objects.
if (isComplexType(ModelContext.fromParent(modelContext, resolvedType))) {
if(modelContext.hasSeenBefore(resolvedType)){
return new HashSet<>();
}
LOG.debug("Marking complex type {} as seen", resolvedType.getSignature());
modelContext.seen(resolvedType);
}

since i am not very familiar with all the rest that is involved, i could imagine this fix may break certain things. thus, it would be nice if you could have a quick look at it.

image

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