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
AnnotationTypeMappings does not filter repeatable annotations #25483
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -474,6 +474,16 @@ private Method[] resolveMirrorSets(AnnotationTypeMapping mapping, Class<?> eleme | |
return result; | ||
} | ||
|
||
@Test | ||
void forAnnotationTypeWhenRepeatableMetaAnnotationFilterd() { | ||
AnnotationTypeMappings mappings = AnnotationTypeMappings.forAnnotationType(WithRepeatedMetaAnnotations.class, | ||
annotationType -> | ||
ObjectUtils.nullSafeEquals(annotationType, Repeating.class.getName())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You omitted the import for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For future reference, I was able to simplify the annotation filter in that test method as follows. @Test
void forAnnotationTypeWhenRepeatableMetaAnnotationIsFiltered() {
AnnotationTypeMappings mappings = AnnotationTypeMappings.forAnnotationType(WithRepeatedMetaAnnotations.class,
Repeating.class.getName()::equals);
assertThat(getAll(mappings)).flatExtracting(AnnotationTypeMapping::getAnnotationType)
.containsExactly(WithRepeatedMetaAnnotations.class);
} However, I won't be merging that change due to reasons I'll explain later. |
||
assertThat(getAll(mappings)).flatExtracting( | ||
AnnotationTypeMapping::getAnnotationType).containsExactly( | ||
WithRepeatedMetaAnnotations.class); | ||
} | ||
|
||
@Nullable | ||
private Method getAliasMapping(AnnotationTypeMapping mapping, int attributeIndex) { | ||
int mapped = mapping.getAliasMapping(attributeIndex); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if that was perhaps a copy-and-paste error and if it should rather be:
@philwebb, what are your thoughts on the matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@philwebb, I'm assuming my above assumption is correct. (I know: a lot of assuming).
In light of that, we'll go forward with the change in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was a typo. A little concerning that no test covered it.