Skip to content

Commit

Permalink
#1287 Fix @DiffIgnoreProperties interference with JaversType resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
kirmerzlikin authored and bartoszwalacik committed Jul 10, 2023
1 parent 975d4d9 commit 9a9337b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class ClassAnnotationsScanner {
private final AnnotationNamesProvider annotationNamesProvider;
private List<Class<? extends Annotation>> JAVERS_TYPE_ANNOTATIONS = Lists.immutableListOf(
DiffIgnore.class,
DiffIgnoreProperties.class,
Entity.class,
ShallowReference.class,
ValueObject.class,
Expand All @@ -43,9 +42,6 @@ public ClassAnnotationsScan scan(Class javaClass){

Optional<String> typeName = annotationNamesProvider.findTypeNameAnnValue(annotations);

Optional<Class<? extends Annotation>> javersTypeAnnotation =
JAVERS_TYPE_ANNOTATIONS.stream().filter(annTypes::contains).findFirst();

boolean hasIgnoreDeclaredProperties = annTypes.contains(IGNORE_DECLARED_PROPERTIES_ANN);

return new ClassAnnotationsScan(typeFromAnnotation(annTypes),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.javers.core.cases

import jakarta.persistence.Id
import org.javers.core.Javers
import org.javers.core.JaversBuilder
import org.javers.core.metamodel.annotation.DiffIgnoreProperties
import org.javers.core.metamodel.annotation.ValueObject
import org.javers.core.metamodel.type.ValueObjectType
import spock.lang.Specification

class Case1287ValueObjectWithIgnoredProperties extends Specification {

@ValueObject
@DiffIgnoreProperties("id")
class MyValueObject {

@Id
private UUID id;

private String property;
}

def "should recognize class as a value object type"() {
given:
Javers javers = JaversBuilder.javers().build()

expect:
javers.getTypeMapping( MyValueObject ) instanceof ValueObjectType
}
}

0 comments on commit 9a9337b

Please sign in to comment.