Allow a MethodReference to be produced from a GeneratedMethod
This commit updates GeneratedMethod and its underlying infrastructure to be able to produce a MethodReference. This simplifies the need when such a reference needs to be created manually and reuses more of what MethodReference has to offer. See gh-29005
This commit is contained in:
@@ -129,8 +129,7 @@ class BeanDefinitionMethodGeneratorTests {
|
||||
.addParameter(RegisteredBean.class, "registeredBean")
|
||||
.addParameter(TestBean.class, "testBean")
|
||||
.returns(TestBean.class).addCode("return new $T($S);", TestBean.class, "postprocessed"));
|
||||
beanRegistrationCode.addInstancePostProcessor(MethodReference.ofStatic(
|
||||
beanRegistrationCode.getClassName(), generatedMethod.getName()));
|
||||
beanRegistrationCode.addInstancePostProcessor(generatedMethod.toMethodReference());
|
||||
};
|
||||
List<BeanRegistrationAotContribution> aotContributions = Collections
|
||||
.singletonList(aotContribution);
|
||||
@@ -167,8 +166,7 @@ class BeanDefinitionMethodGeneratorTests {
|
||||
.addParameter(RegisteredBean.class, "registeredBean")
|
||||
.addParameter(TestBean.class, "testBean")
|
||||
.returns(TestBean.class).addCode("return new $T($S);", TestBean.class, "postprocessed"));
|
||||
beanRegistrationCode.addInstancePostProcessor(MethodReference.ofStatic(
|
||||
beanRegistrationCode.getClassName(), generatedMethod.getName()));
|
||||
beanRegistrationCode.addInstancePostProcessor(generatedMethod.toMethodReference());
|
||||
};
|
||||
List<BeanRegistrationAotContribution> aotContributions = Collections
|
||||
.singletonList(aotContribution);
|
||||
|
||||
Reference in New Issue
Block a user