Skip to content

Commit f157eff

Browse files
Remove usage of RuntimeHintsUtils & SynthesizedAnnotation.
Closes: #2685
1 parent 1ccdac2 commit f157eff

File tree

3 files changed

+10
-33
lines changed

3 files changed

+10
-33
lines changed

src/main/java/org/springframework/data/aot/TypeContributor.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.springframework.aot.generate.GenerationContext;
2424
import org.springframework.aot.hint.MemberCategory;
2525
import org.springframework.core.annotation.MergedAnnotation;
26-
import org.springframework.core.annotation.SynthesizedAnnotation;
2726

2827
/**
2928
* @author Christoph Strobl
@@ -51,32 +50,30 @@ public static void contribute(Class<?> type, GenerationContext contribution) {
5150
* @param contribution
5251
*/
5352
@SuppressWarnings("unchecked")
54-
public static void contribute(Class<?> type, Predicate<Class<? extends Annotation>> filter, GenerationContext contribution) {
53+
public static void contribute(Class<?> type, Predicate<Class<? extends Annotation>> filter,
54+
GenerationContext contribution) {
5555

5656
if (type.isPrimitive()) {
5757
return;
5858
}
5959

6060
if (type.isAnnotation() && filter.test((Class<? extends Annotation>) type)) {
6161

62-
contribution.getRuntimeHints().reflection().registerType(type, hint ->
63-
hint.withMembers(MemberCategory.INTROSPECT_PUBLIC_METHODS));
62+
contribution.getRuntimeHints().reflection().registerType(type,
63+
hint -> hint.withMembers(MemberCategory.INTROSPECT_PUBLIC_METHODS));
6464

65-
// TODO: do we need this if meta annotated with SD annotation?
66-
if (type.getPackage().getName().startsWith(DATA_NAMESPACE)) {
67-
contribution.getRuntimeHints().proxies().registerJdkProxy(type, SynthesizedAnnotation.class);
68-
}
6965
return;
7066
}
7167

7268
if (type.isInterface()) {
73-
contribution.getRuntimeHints().reflection().registerType(type, hint ->
74-
hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));
69+
contribution.getRuntimeHints().reflection().registerType(type,
70+
hint -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_METHODS));
7571
return;
7672
}
7773

78-
contribution.getRuntimeHints().reflection().registerType(type, hint ->
79-
hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.DECLARED_FIELDS));
74+
contribution.getRuntimeHints().reflection().registerType(type,
75+
hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_PUBLIC_METHODS,
76+
MemberCategory.DECLARED_FIELDS));
8077
}
8178

8279
/**

src/main/java/org/springframework/data/aot/hint/RepositoryRuntimeHints.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader)
7777

7878
// annotated queries
7979
hints.proxies().registerJdkProxy( //
80-
TypeReference.of("org.springframework.data.annotation.QueryAnnotation"), //
81-
TypeReference.of("org.springframework.core.annotation.SynthesizedAnnotation"));
80+
TypeReference.of("org.springframework.data.annotation.QueryAnnotation"));
8281
}
8382
}

src/test/java/org/springframework/data/aot/RepositoryRegistrationAotProcessorIntegrationTests.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.io.Serializable;
2222

2323
import org.junit.jupiter.api.Test;
24-
2524
import org.springframework.aop.SpringProxy;
2625
import org.springframework.aop.framework.Advised;
2726
import org.springframework.aot.hint.RuntimeHints;
@@ -30,8 +29,6 @@
3029
import org.springframework.beans.factory.support.RegisteredBean;
3130
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
3231
import org.springframework.core.DecoratingProxy;
33-
import org.springframework.core.annotation.SynthesizedAnnotation;
34-
import org.springframework.data.annotation.QueryAnnotation;
3532
import org.springframework.data.aot.sample.ConfigWithCustomImplementation;
3633
import org.springframework.data.aot.sample.ConfigWithCustomRepositoryBaseClass;
3734
import org.springframework.data.aot.sample.ConfigWithFragments;
@@ -44,7 +41,6 @@
4441
import org.springframework.data.domain.Page;
4542
import org.springframework.data.repository.PagingAndSortingRepository;
4643
import org.springframework.data.repository.Repository;
47-
import org.springframework.data.repository.query.Param;
4844
import org.springframework.data.repository.reactive.ReactiveSortingRepository;
4945
import org.springframework.transaction.interceptor.TransactionalProxy;
5046

@@ -264,21 +260,6 @@ void contributesProxiesForPotentialProjections() {
264260
});
265261
}
266262

267-
@Test // GH-2593
268-
void contributesProxiesForDataAnnotations() {
269-
270-
RepositoryRegistrationAotContribution repositoryBeanContribution = computeAotConfiguration(
271-
ConfigWithQueryMethods.class).forRepository(ConfigWithQueryMethods.CustomerRepositoryWithQueryMethods.class);
272-
273-
assertThatContribution(repositoryBeanContribution) //
274-
.codeContributionSatisfies(contribution -> {
275-
276-
contribution.contributesJdkProxy(Param.class, SynthesizedAnnotation.class);
277-
contribution.contributesJdkProxy(ConfigWithQueryMethods.CustomQuery.class, SynthesizedAnnotation.class);
278-
contribution.contributesJdkProxy(QueryAnnotation.class, SynthesizedAnnotation.class);
279-
});
280-
}
281-
282263
@Test // GH-2593
283264
void doesNotCareAboutNonDataAnnotations() {
284265

0 commit comments

Comments
 (0)