Skip to content

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

@kirmerzlikin

Description

@kirmerzlikin

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions