MethodInvocationRecorder now supports traversing primitive properties.

We now return a default value for invocations of methods returning a primitive value to pass the AOP infrastructure's check for compatible values. Before, that barked at the null value returned for the invocation.

Fixes #2612.
This commit is contained in:
Oliver Drotbohm
2022-05-04 14:57:45 +02:00
parent 23ad2f0b3f
commit c1012f5ba5
2 changed files with 19 additions and 5 deletions

View File

@@ -86,6 +86,14 @@ class MethodInvocationRecorderUnitTests {
assertThat(recorder.record(Sample::getName).getPropertyPath()).hasValue("name");
}
@Test // #2612
void registersLookupForPrimitiveValue() {
var recorder = MethodInvocationRecorder.forProxyOf(Foo.class);
assertThat(recorder.record(Foo::getAge).getPropertyPath()).hasValue("age");
}
static final class FinalType {}
@Getter
@@ -93,6 +101,7 @@ class MethodInvocationRecorderUnitTests {
Bar bar;
Collection<Bar> bars;
String name;
int age;
}
@Getter