Closed as not planned
Description
Affects: 6.1.1
In version 6.0.13 following repro works:
@Test
void should() throws Exception {
TestSpel testSpel = new TestSpel();
DefaultParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
SpelExpression expression = new SpelExpressionParser().parseRaw("#parameter.value()");
Method method1 = testSpel.getClass().getDeclaredMethod("method1", RecordParameter.class);
Object[] parameters1 = new Object[]{new RecordParameter("testing record")};
MethodBasedEvaluationContext context1 = new MethodBasedEvaluationContext(testSpel, method1, parameters1, parameterNameDiscoverer);
Object value1 = expression.getValue(context1);
assertThat(value1).isEqualTo("testing record");
}
static class TestSpel {
void method1(RecordParameter parameter) {
}
}
record RecordParameter(String value) {
}
After bump to 6.1.1 following exception is thrown:
org.springframework.expression.spel.SpelEvaluationException: EL1011E: Method call: Attempted to call method value() on null context object
at org.springframework.expression.spel.ast.MethodReference.throwIfNotNullSafe(MethodReference.java:166)
at org.springframework.expression.spel.ast.MethodReference.getValueRef(MethodReference.java:95)
at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:76)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:97)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:114)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:273)