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

@@ -170,7 +170,7 @@ class TestCompilerTests {
}
@Test
@CompileWithTargetClassAccess(classNames = "com.example.PackagePrivate")
@CompileWithTargetClassAccess
void compiledCodeCanAccessExistingPackagePrivateClassIfAnnotated() throws ClassNotFoundException, LinkageError {
SourceFiles sourceFiles = SourceFiles.of(SourceFile.of("""
package com.example;