Skip to content

EntityDefinition doesn't pick up inherited fields/methods #640

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

Closed
jamesdbaker opened this issue Feb 22, 2018 · 3 comments
Closed

EntityDefinition doesn't pick up inherited fields/methods #640

jamesdbaker opened this issue Feb 22, 2018 · 3 comments

Comments

@jamesdbaker
Copy link

I have some interfaces defined as follows:

public interface WithId {
  String getId();
}

public interface MyObject extends WithId {
  //getId() is inherited
  //Some more methods, properties, etc
}

When I try to register the object (with the following), it fails to detect the id property as expected:

Javers javers = JaversBuilder.javers()
    .withMappingStyle(MappingStyle.BEAN)
    .registerEntity(new EntityDefinition(MyObject.class, "id"))
    .build();

The error I get is: PROPERTY_NOT_FOUND: property 'id' not found in class 'MyObject'

If the getId() method is directly on MyObject, then the code above works as expected. This is using javers-core version 3.7.5.

@bartoszwalacik
Copy link
Member

And what about the concrete class?

@jamesdbaker
Copy link
Author

A concrete implementation doesn't throw an error, but in my use case I don't necessarily know what concrete implementation I'm going to be passed (just that it will implement the interface MyObject).

@bartoszwalacik
Copy link
Member

fix released in 3.8.2

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

No branches or pull requests

2 participants