Allow @CompileWithTargetClassAccess to work with all classes

Switch from `MethodHandles.privateLookupIn` to a reflection based
approach to that target classes to not need to be explicitly listed.

Closes gh-28580
This commit is contained in:
Phillip Webb
2022-06-07 14:12:15 -07:00
parent c01a2e897d
commit 46a2f2d71c
7 changed files with 33 additions and 90 deletions

View File

@@ -91,7 +91,7 @@ class AutowiredAnnotationBeanRegistrationAotContributionTests {
}
@Test
@CompileWithTargetClassAccess(classes = PackagePrivateFieldInjectionSample.class)
@CompileWithTargetClassAccess
void contributeWhenPackagePrivateFieldInjectionInjectsUsingConsumer() {
Environment environment = new StandardEnvironment();
this.beanFactory.registerSingleton("environment", environment);
@@ -122,7 +122,7 @@ class AutowiredAnnotationBeanRegistrationAotContributionTests {
}
@Test
@CompileWithTargetClassAccess(classes = PackagePrivateMethodInjectionSample.class)
@CompileWithTargetClassAccess
void contributeWhenPackagePrivateMethodInjectionInjectsUsingConsumer() {
Environment environment = new StandardEnvironment();
this.beanFactory.registerSingleton("environment", environment);

View File

@@ -342,7 +342,7 @@ class BeanDefinitionMethodGeneratorTests {
}
@Test
@CompileWithTargetClassAccess(classes = PackagePrivateTestBean.class)
@CompileWithTargetClassAccess
void generateBeanDefinitionMethodWhenPackagePrivateBean() {
RegisteredBean registeredBean = registerBean(
new RootBeanDefinition(PackagePrivateTestBean.class));