Skip to content
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

IndexAccessor cannot support custom Collection target type #32736

Closed
sbrannen opened this issue Apr 30, 2024 · 0 comments
Closed

IndexAccessor cannot support custom Collection target type #32736

sbrannen opened this issue Apr 30, 2024 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Apr 30, 2024

Overview

Due to the current implementation of SpEL's Indexer, an IndexAccessor cannot provide custom support for a Collection target type.

The reason is that Indexer owns the Collection target type.

else if (target instanceof Collection<?> collection) {
if (target instanceof List) {
this.indexedType = IndexedType.LIST;
}
return new CollectionIndexingValueRef(collection, idx, targetDescriptor,
state.getTypeConverter(), state.getConfiguration().isAutoGrowCollections(),
state.getConfiguration().getMaximumAutoGrowSize());
}

We should be able to ensure that a custom IndexAccessor can provide support for a Collection target type by separating our built-in List and Collection support and applying the built-in Collection support after custom index accessors have been applied, analogous to what we did in #32706. The built-in List support should still be applied before custom index accessors and therefore remain unchanged.

Related Issues

@sbrannen sbrannen added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Apr 30, 2024
@sbrannen sbrannen added this to the 6.2.0-M2 milestone Apr 30, 2024
@sbrannen sbrannen self-assigned this Apr 30, 2024
@sbrannen sbrannen changed the title IndexAccessor cannot support custom Collection index type IndexAccessor cannot support custom Collection target type May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant