Skip to content

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

@Syntobe

Description

@Syntobe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions