Skip to content

IndexAccessor cannot support custom Collection target type #32736

@sbrannen

Description

@sbrannen

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

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions