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.

Comment From: xixingya

Maybe Void is not boxed

Comment From: snicoll

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.

Comment From: sbrannen

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.