Skip to content

Commit 9846d28

Browse files
committed
Remove support for declaring class proxies hints
Closes gh-28972
1 parent f4389c3 commit 9846d28

File tree

4 files changed

+1
-341
lines changed

4 files changed

+1
-341
lines changed

spring-core/src/main/java/org/springframework/aot/hint/ClassProxyHint.java

Lines changed: 0 additions & 172 deletions
This file was deleted.

spring-core/src/main/java/org/springframework/aot/hint/ProxyHints.java

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import java.util.function.Consumer;
2222
import java.util.stream.Stream;
2323

24-
import org.springframework.aot.hint.ClassProxyHint.Builder;
25-
2624
/**
2725
* Gather the need for using proxies at runtime.
2826
*
@@ -33,8 +31,6 @@ public class ProxyHints {
3331

3432
private final Set<JdkProxyHint> jdkProxies = new LinkedHashSet<>();
3533

36-
private final Set<ClassProxyHint> classProxies = new LinkedHashSet<>();
37-
3834

3935
/**
4036
* Return the interface-based proxies that are required.
@@ -44,14 +40,6 @@ public Stream<JdkProxyHint> jdkProxies() {
4440
return this.jdkProxies.stream();
4541
}
4642

47-
/**
48-
* Return the class-based proxies that are required.
49-
* @return a stream of {@link ClassProxyHint}
50-
*/
51-
public Stream<ClassProxyHint> classProxies() {
52-
return this.classProxies.stream();
53-
}
54-
5543
/**
5644
* Register a {@link JdkProxyHint}.
5745
* @param jdkProxyHint the consumer of the hint builder
@@ -90,31 +78,4 @@ public ProxyHints registerJdkProxy(Class<?>... proxiedInterfaces) {
9078
jdkProxyHint.proxiedInterfaces(proxiedInterfaces));
9179
}
9280

93-
/**
94-
* Register that a class proxy is required for the class defined by the
95-
* specified {@link TypeReference}.
96-
* @param typeReference the type reference for the target class of the proxy
97-
* @param classProxyHint a builder to further customize the hint for that proxy
98-
* @return {@code this}, to facilitate method chaining
99-
*/
100-
public ProxyHints registerClassProxy(TypeReference typeReference, Consumer<Builder> classProxyHint) {
101-
return addClassProxyHint(ClassProxyHint.of(typeReference), classProxyHint);
102-
}
103-
104-
/**
105-
* Register that a class proxy is required for the specified class.
106-
* @param targetClass the target class of the proxy
107-
* @param classProxyHint a builder to further customize the hint for that proxy
108-
* @return {@code this}, to facilitate method chaining
109-
*/
110-
public ProxyHints registerClassProxy(Class<?> targetClass, Consumer<Builder> classProxyHint) {
111-
return addClassProxyHint(ClassProxyHint.of(targetClass), classProxyHint);
112-
}
113-
114-
private ProxyHints addClassProxyHint(ClassProxyHint.Builder builder, Consumer<ClassProxyHint.Builder> classProxyHint) {
115-
classProxyHint.accept(builder);
116-
this.classProxies.add(builder.build());
117-
return this;
118-
}
119-
12081
}

spring-core/src/test/java/org/springframework/aot/hint/ClassProxyHintTests.java

Lines changed: 0 additions & 101 deletions
This file was deleted.

spring-core/src/test/java/org/springframework/aot/hint/ProxyHintsTests.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
package org.springframework.aot.hint;
1818

19-
import java.io.Serializable;
2019
import java.util.Arrays;
21-
import java.util.Properties;
2220
import java.util.function.Consumer;
2321
import java.util.function.Function;
2422

@@ -82,33 +80,6 @@ void registerJdkProxyTwiceExposesOneHint() {
8280
assertThat(this.proxyHints.jdkProxies()).singleElement().satisfies(proxiedInterfaces(Function.class));
8381
}
8482

85-
@Test
86-
void registerClassProxyWithTargetClassName() {
87-
this.proxyHints.registerClassProxy(TypeReference.of(Properties.class.getName()), classProxyHint ->
88-
classProxyHint.proxiedInterfaces(Serializable.class));
89-
assertThat(this.proxyHints.classProxies()).singleElement().satisfies(classProxyHint -> {
90-
assertThat(classProxyHint.getTargetClass()).isEqualTo(TypeReference.of(Properties.class));
91-
assertThat(classProxyHint.getProxiedInterfaces()).containsOnly(TypeReference.of(Serializable.class));
92-
});
93-
}
94-
95-
@Test
96-
void registerClassProxyWithTargetClass() {
97-
this.proxyHints.registerClassProxy(Properties.class, classProxyHint ->
98-
classProxyHint.proxiedInterfaces(Serializable.class));
99-
assertThat(this.proxyHints.classProxies()).singleElement().satisfies(classProxyHint -> {
100-
assertThat(classProxyHint.getTargetClass()).isEqualTo(TypeReference.of(Properties.class));
101-
assertThat(classProxyHint.getProxiedInterfaces()).containsOnly(TypeReference.of(Serializable.class));
102-
});
103-
}
104-
105-
@Test
106-
void registerClassProxyWithTargetInterface() {
107-
assertThatIllegalArgumentException()
108-
.isThrownBy(() -> this.proxyHints.registerClassProxy(Serializable.class, classProxyHint -> {}))
109-
.withMessageContaining(Serializable.class.getName());
110-
}
111-
11283

11384
private static Consumer<JdkProxyHint.Builder> springProxy(String proxiedInterface) {
11485
return builder -> builder.proxiedInterfaces(toTypeReferences(
@@ -140,6 +111,7 @@ private static TypeReference[] toTypeReferences(Class<?>... proxiedInterfaces) {
140111
sealed interface SealedInterface {
141112
}
142113

114+
@SuppressWarnings("unused")
143115
static final class SealedClass implements SealedInterface {
144116
}
145117

0 commit comments

Comments
 (0)