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

SpEL cannot evaluate or compile expression with null-safe void method invocation #27421

Closed
rgrvontela opened this issue Sep 16, 2021 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@rgrvontela
Copy link

rgrvontela commented Sep 16, 2021

org.springframework.expression.spel.CodeFlow.toBoxedDescriptor() throws "Unexpected non primitive descriptor V" while trying to create a MethodReference for a method with a void return type.

For an analogous scenario using java.lang.Void as the return type, no exception is thrown.

I think while checking for primitives using method CodeFlow.toDescriptor() that "V" is returned for a void return type, but the returned "V" is not handled in the CodeFlow.toBoxedDesciptor() method.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 16, 2021
@xixingya
Copy link
Contributor

Maybe Void is not boxed

@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 10, 2021
@snicoll
Copy link
Member

snicoll commented Sep 25, 2023

There is indeed an inconsistency here that we attempt to box void for null safety reason but that's not necessary with void.

@rgrvontela that explains why Void works as it's a non-primitive type.

@snicoll snicoll changed the title Issue: org.springframework.expression.spel.CodeFlow.toBoxedDescriptor() throws "Unexpected non primitive descriptor V" while trying to create a MethodReference for a method with primitive void return type. CodeFlow.toBoxedDescriptor() should not attempt to box void Sep 25, 2023
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 25, 2023
@snicoll snicoll added this to the 6.x Backlog milestone Sep 25, 2023
@sbrannen sbrannen changed the title CodeFlow.toBoxedDescriptor() should not attempt to box void CodeFlow.toBoxedDescriptor() should not attempt to box void during SpEL compilation Sep 25, 2023
@sbrannen
Copy link
Member

sbrannen commented Sep 25, 2023

I think the bug might be that org.springframework.expression.spel.CodeFlow.isPrimitive(String) should not return true for "V".

See also org.springframework.expression.spel.CodeFlow.insertBoxIfNecessary(...)

I'll look into it.

@sbrannen sbrannen self-assigned this Sep 25, 2023
@sbrannen sbrannen changed the title CodeFlow.toBoxedDescriptor() should not attempt to box void during SpEL compilation SpEL compilation should not attempt to box void Sep 25, 2023
@sbrannen sbrannen modified the milestones: 6.x Backlog, 6.0.13 Sep 25, 2023
@sbrannen sbrannen changed the title SpEL compilation should not attempt to box void SpEL fails to evaluate and compile expression with null-safe void method invocation Sep 28, 2023
@sbrannen sbrannen changed the title SpEL fails to evaluate and compile expression with null-safe void method invocation SpEL cannot evaluate or compile expression with null-safe void method invocation Sep 28, 2023
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

6 participants