Open mumukiller opened 1 year ago
Include ElementType.METHOD
in your annotation:
@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface SensitiveField {}
...so that the accessor method will get the annotation directly, instead of getting it from the field during "annotation merging" process.
Caused by #3737, specifically: https://github.com/FasterXML/jackson-databind/blob/2cea7c9ce9cbdcb14e22838ea07937c376b7ab78/src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertiesCollector.java#L1012-L1013
...leading to the fields being removed by: https://github.com/FasterXML/jackson-databind/blob/2cea7c9ce9cbdcb14e22838ea07937c376b7ab78/src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertyBuilder.java#L954-L955
When I created #3894 to refine/partially revert #3737, I did not also propagate the changes to _removeUnwantedAccessor
because I don't understand what it is doing.
One more suggestion: while it may not make a difference, it's probably worth checking if this still occurs with 2.15.2, given there are a few changes related to Record annotation handling.
Sorry if it's duplicate but i did not find anything like that
Describe the bug When using custom annotation, Annotated.getAnnotation() method does not return annotation for a field marked with this annotation.
Version information 2.15.0
To Reproduce This simple test can help:
Expected behavior When i use jackson-core:2.14.1 the test below passes successfully When i use jackson-core:2.15.0 the test fails
Additional context This happened when i updated Spring Boot from 3.0.2 to 3.1.0 This is my graddle build