Skip to content

SpEL: Unnecessary conversion of Map<?, ?> arguments [SPR-8518] #13163

@spring-projects-issues

Description

@spring-projects-issues

Grzegorz Grzybek opened SPR-8518 and commented

@kdonald

In revision 4483 there was a change in org.springframework.expression.spel.support.ReflectionHelper.convertArguments(TypeConverter, Object[], Object, int[], Integer). Now all arguments are converted.

I have a problem with SpEL, where root object is map (but it's a general problem with Map arguments) - it's a problem w Java generics, where type arguments may be deducted from method parameters, but not from actual arguments:

// method
void mapArg(Map<String, Object> arg1);
// type descriptor for method parameter
new TypeDescriptor(MethodParameter.forMethodOrConstructor(methodOrCtor, i));
// type descriptor for actual argument
TypeDescriptor.forObject(argument)

Spring converts Map<String, Object> because it determines it's Map<?, ?>, which results in new Map being passed to actual method. When the map is EvaluationContext's root object, it's not the root map which is passed to SpEL invoked method, so I can't use SpEL to fill passed map...

I know it can't be resolved because of type erasure - but can this be specified in documentation somehow?

regards
Grzegorz Grzybek


Affects: 3.1 M2

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions