Skip to content

SpEL: parsing exception when combining null-safe navigation and list indexing [SPR-16929] #21468

Closed as not planned
@spring-projects-issues

Description

@spring-projects-issues

Juan Domínguez González opened SPR-16929 and commented

When parsing an expression which combines null-safe and list/array navigation it fails with a parse exception.

Example: accessing first element of a (possibly null) list/array of strings: stringList?[0]

org.springframework.expression.spel.SpelParseException: EL1041E: After parsing a valid expression, there is still more data in the expression: 'select(?[)

I'm not sure if the syntax I've used is correct, but, to me it seems the most natural one.

Combining the null safe operator and navigation using get, seems to work: e.j: stringList?.get(0)

Alternative syntaxes, such as (stringList?)[0] or stringList?.[0], also fail to compile..


Affects: 4.3.16

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: supersededAn issue that has been superseded by anothertype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions