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

Intermediate generic parent scenario: Don't know how to extract Class from type 'ID'. #501

prook opened this issue Feb 22, 2017 · 1 comment


Copy link

@prook prook commented Feb 22, 2017

Consider the following class hierarchy, note the ID type parameter in particular:

class Identified<ID> {
    ID id;

class Versioned<ID, VER> extends Identified<ID> {
    VER version;

class Person extends Versioned<Long, Long> {
    String name;

class PersonTest {
    public void testCompare() {
        Javers javers = JaversBuilder.javers().build(); Person(), new Person());

Instead of resolving ID to Long, JaVers blows up:

o.j.c.m.t.TypeMapper - Can't calculate JaversType for property: Field ID id; //declared in Identified

JaversException CLASS_EXTRACTION_ERROR: JaVers bootstrap error - Don't know how to extract Class from type 'ID'.

at org.javers.common.reflection.ReflectionUtil.extractClass(
at org.javers.core.metamodel.type.TypeMapperState.findNearestAncestor(
at org.javers.core.metamodel.type.TypeMapperState.infer(
at org.javers.core.metamodel.type.TypeMapperState.lambda$getJaversType$18(
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.TypeMapper.getPropertyType(
at org.javers.core.graph.ObjectGraphBuilder.lambda$getSingleReferencesWithManagedTypes$43(
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(

Observed in JaVers 2.9.2 and 3.0.0.

@prook prook changed the title CLASS_EXTRACTION_ERROR: Don't know how to extract Class from type 'ID' Intermediate generic parent scenario: Don't know how to extract Class from type 'ID'. Feb 23, 2017
bartoszwalacik added a commit that referenced this issue Feb 24, 2017
error reproduction
@bartoszwalacik bartoszwalacik added the bug label Feb 24, 2017
bartoszwalacik added a commit that referenced this issue Feb 26, 2017
Copy link

@bartoszwalacik bartoszwalacik commented Mar 3, 2017

fixed in 3.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants