Remove AopProxyUtils.completeJdkProxyInterfaces(String...)

Since gh-28781 is still open for team discussion, this commit removes
the `String...` variant for AopProxyUtils.completeJdkProxyInterfaces.

Depending on the outcome of gh-28781, this method may be reintroduced
in 6.0 M6.

Closes gh-28745
This commit is contained in:
Sam Brannen 2022-07-11 17:03:50 +02:00
parent 7bfcb4c753
commit 49dfcad447
2 changed files with 0 additions and 53 deletions

View File

@ -21,7 +21,6 @@ import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.springframework.aop.SpringProxy;
@ -119,7 +118,6 @@ public abstract class AopProxyUtils {
* @see DecoratingProxy
* @see org.springframework.aot.hint.RuntimeHints#proxies()
* @see org.springframework.aot.hint.ProxyHints#registerJdkProxy(Class...)
* @see #completeJdkProxyInterfaces(String...)
*/
public static Class<?>[] completeJdkProxyInterfaces(Class<?>... userInterfaces) {
List<Class<?>> completedInterfaces = new ArrayList<>(userInterfaces.length + 3);
@ -135,40 +133,6 @@ public abstract class AopProxyUtils {
return completedInterfaces.toArray(Class<?>[]::new);
}
/**
* Complete the set of interfaces that are typically required in a JDK dynamic
* proxy generated by Spring AOP.
* <p>Specifically, {@link SpringProxy}, {@link Advised}, and {@link DecoratingProxy}
* will be appended to the set of user-specified interfaces.
* <p>This method can be useful when registering
* {@linkplain org.springframework.aot.hint.ProxyHints proxy hints} for Spring's
* AOT support, as demonstrated in the following example which uses this method
* via a {@code static} import.
* <pre class="code">
* RuntimeHints hints = ...
* hints.proxies().registerJdkProxy(completeJdkProxyInterfaces("com.example.MyInterface"));
* </pre>
* @param userInterfaces the set of fully qualified names of user-specified
* interfaces implemented by the component to be proxied
* @return the complete set of fully qualified names of interfaces that the
* proxy should implement
* @since 6.0
* @see SpringProxy
* @see Advised
* @see DecoratingProxy
* @see org.springframework.aot.hint.RuntimeHints#proxies()
* @see org.springframework.aot.hint.ProxyHints#registerJdkProxy(Class...)
* @see #completeJdkProxyInterfaces(Class...)
*/
public static String[] completeJdkProxyInterfaces(String... userInterfaces) {
List<String> completedInterfaces = new ArrayList<>(userInterfaces.length + 3);
Collections.addAll(completedInterfaces, userInterfaces);
completedInterfaces.add(SpringProxy.class.getName());
completedInterfaces.add(Advised.class.getName());
completedInterfaces.add(DecoratingProxy.class.getName());
return completedInterfaces.toArray(String[]::new);
}
/**
* Determine the complete set of interfaces to proxy for the given AOP configuration.
* <p>This will always add the {@link Advised} interface unless the AdvisedSupport's

View File

@ -144,23 +144,6 @@ class AopProxyUtilsTests {
ITestBean.class, Comparable.class, SpringProxy.class, Advised.class, DecoratingProxy.class);
}
@Test
void completeJdkProxyInterfacesFromSingleClassName() {
String[] jdkProxyInterfaces = AopProxyUtils.completeJdkProxyInterfaces(ITestBean.class.getName());
assertThat(jdkProxyInterfaces).containsExactly(
ITestBean.class.getName(), SpringProxy.class.getName(), Advised.class.getName(),
DecoratingProxy.class.getName());
}
@Test
void completeJdkProxyInterfacesFromMultipleClassNames() {
String[] jdkProxyInterfaces =
AopProxyUtils.completeJdkProxyInterfaces(ITestBean.class.getName(), Comparable.class.getName());
assertThat(jdkProxyInterfaces).containsExactly(
ITestBean.class.getName(), Comparable.class.getName(), SpringProxy.class.getName(),
Advised.class.getName(), DecoratingProxy.class.getName());
}
sealed interface SealedInterface {
}