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

"error calling Constructor for CustomType" exception when CustomPropertyComparator is registered for value's parent class #789

kkonstantin42 opened this Issue Feb 19, 2019 · 3 comments


None yet
2 participants
Copy link

kkonstantin42 commented Feb 19, 2019

error calling Constructor for org.javers.core.metamodel.type.CustomType exception is thrown on when there is a CustomPropertyComparator registered for a parent class of some value that exist in objects that are being compared.

Here is a test case that reproduces the issue:

This behaviour has appeared after CustomType constructor was changed to accept CustomPropertyComparator as a second parameter in this commit: ec6113b#diff-461b37401e91dc6db100811e06995807
Possibly there should be a special case in TypeFactory.spawnFromPrototype method that would handle creation of CustomType objects. Can submit a PR.

Here is a stacktrace:

java.lang.RuntimeException: error calling Constructor for org.javers.core.metamodel.type.CustomType

	at org.javers.core.metamodel.type.JaversType.spawn(
	at org.javers.core.metamodel.type.TypeFactory.spawnFromPrototype(
	at org.javers.core.metamodel.type.TypeFactory.infer(
	at org.javers.core.metamodel.type.TypeMapperState.infer(
	at org.javers.core.metamodel.type.TypeMapperState.lambda$getJaversType$0(
	at org.javers.core.metamodel.type.TypeMapperState.computeIfAbsent(
	at org.javers.core.metamodel.type.TypeMapperState.getJaversType(
	at org.javers.core.metamodel.type.TypeMapper.getJaversType(
	at org.javers.core.metamodel.type.ManagedClassFactory.lambda$null$2(
	at org.javers.core.metamodel.type.JaversProperty.getType(
	at org.javers.core.graph.ObjectGraphBuilder.lambda$getSingleReferencesWithManagedTypes$0(
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(
	at org.javers.common.collections.Lists.positiveFilter(
	at org.javers.core.metamodel.type.ManagedClass.getManagedProperties(
	at org.javers.core.metamodel.type.ManagedType.getProperties(
	at org.javers.core.graph.ObjectGraphBuilder.getSingleReferencesWithManagedTypes(
	at org.javers.core.graph.ObjectGraphBuilder.buildSingleEdges(
	at org.javers.core.graph.ObjectGraphBuilder.buildEdges(
	at org.javers.core.graph.ObjectGraphBuilder.buildGraphFromCdo(
	at org.javers.core.graph.ObjectGraphBuilder.buildGraph(
	at org.javers.core.graph.LiveGraphFactory.createLiveGraph(
	at org.javers.core.diff.DiffFactory.buildGraph(
	at org.javers.core.cases.CustomPropertyComparatorWithInheritanceCase.should use CustomPropertyComparator for all subclasses(CustomPropertyComparatorWithInheritanceCase.groovy:65)
Caused by: java.lang.NoSuchMethodException: org.javers.core.metamodel.type.CustomType.<init>(java.lang.reflect.Type)
	at java.lang.Class.getConstructor0(
	at java.lang.Class.getConstructor(
	at org.javers.core.metamodel.type.JaversType.spawn(
	... 30 more

This comment has been minimized.

Copy link

bartoszwalacik commented Feb 19, 2019

thanks for reporting, would you like to fix this by contributing a PR?


This comment has been minimized.

Copy link

kkonstantin42 commented Feb 19, 2019

Sure. Have submitted a PR #791.


This comment has been minimized.

Copy link

bartoszwalacik commented Feb 23, 2019

fix released in 5.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.