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

@DiffIgnoreProperties prevents @ValueObject and other type annotations from being detected #1287

Closed
kirmerzlikin opened this issue May 13, 2023 · 4 comments

Comments

@kirmerzlikin
Copy link
Contributor

kirmerzlikin commented May 13, 2023

Clear description of my expectations versus reality
Expectation: having annotation @DiffIgnoreProperties on your class does not affect the JaversType resolution for said class.
Reality: with @DiffIgnoreProperties on your class, no type annotations (e.g. @ValueObject, @Entity) will be recognized, which may affect JaversType resolution (in case the deduced type differs from the one declared via the type annotation).

Steps To Reproduce
I have a runnable test case which isolates the bug and allows Javers Core Team to easily reproduce it. I have pushed this test case to my fork of this repository:

https://github.com/kirmerzlikin/javers/tree/diff-ignore-properties-bug/javers-core/src/test/groovy/org/javers/core/cases/Case1287ValueObjectWithIgnoredProperties.groovy

Javers' Version
7.0.0

Additional context
This bug is caused by the change made in scope of PR #1267 that introduced the annotation @DiffIgnoreProperties (initially called @DiffIgnoreFields) to JaVers. In that PR this annotation was added to the list of annotations detected by ClassAnnotationsScanner which are supposed to declare a class as a certain JaversType. Since only first of the found annotations from that list is used, and since @DiffIgnoreProperties appears early in that list, it prevents other annotations from being recognized. The problem here is that @DiffIgnoreProperties shouldn't be in that list at all, since it's not meant to be an indicator of a JaversType.

I have a fix for this bug in the branch diff-ignore-properties-fix of my fork and will be happy to submit a PR here.

@bartoszwalacik
Copy link
Member

hi @kirmerzlikin , thanks for a high quality bug report and a possible fix, could you please create a PR?

@kirmerzlikin
Copy link
Contributor Author

hi @bartoszwalacik, did you have a chance to take a look at the PR?

@bartoszwalacik
Copy link
Member

Hi @kirmerzlikin , sorry for the delay, I will take a look at this in this week

@bartoszwalacik
Copy link
Member

@kirmerzlikin thanks for this fix, it's brilliant, I will release it tomorrow in javers-7.0.3

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

Successfully merging a pull request may close this issue.

2 participants