Skip to content

Consider changes to MergedAnnotation.asMap #22738

@philwebb

Description

@philwebb

It's currently quite hard to convert a MergedAnnotation to an AnnotationAttributes instance. At one point early in the design we had a factory method on AnnotationAttributes that allowed it to be used with asMap:

mergedAnnotation.asMap(AnnotationAttributes::ifPresent);

We removed that because it wasn't great having an asMap method that could return null.

Originally I didn't want to tie MergedAnnotation to AnnotationAttributes because I thought there was too much overlap. In hindsight, I'm not sure we can ever remove AnnotationAttributes so perhaps we should just embrace it and add an asAnnotationAttributes method. We could even drop asMap and the custom factory version which probably only exists to support AnnotationAttributes.

We should also reconsider the MapValues enum name. It's not that great.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: taskA general task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions