Skip to content

Commit

Permalink
Merge branch '6.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
sdeleuze committed Apr 10, 2024
2 parents 35a0d24 + cf1e432 commit 47f274a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -66,6 +66,10 @@ private void registerHints(Class<?> type, RuntimeHints runtimeHints) {
if (superClass != null) {
registerHints(superClass, runtimeHints);
}
Class<?> enclosingClass = type.getEnclosingClass();
if (enclosingClass != null) {
registerHints(enclosingClass, runtimeHints);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -66,6 +66,17 @@ class KotlinReflectionBeanRegistrationAotProcessorTests {
assertThat(generationContext.runtimeHints.reflection().typeHints()).isEmpty()
}

@Test
fun shouldGenerateOuterClassHints() {
process(OuterBean.NestedBean::class.java)
assertThat(
RuntimeHintsPredicates.reflection()
.onType(OuterBean.NestedBean::class.java)
.withMemberCategory(MemberCategory.INTROSPECT_DECLARED_METHODS).and(RuntimeHintsPredicates.reflection()
.onType(OuterBean::class.java).withMemberCategory(MemberCategory.INTROSPECT_DECLARED_METHODS))
).accepts(generationContext.runtimeHints)
}

private fun process(beanClass: Class<*>) {
createContribution(beanClass)?.applyTo(generationContext, Mockito.mock(BeanRegistrationCode::class.java))
}
Expand All @@ -87,4 +98,8 @@ class KotlinReflectionBeanRegistrationAotProcessorTests {
}
}

class OuterBean {
class NestedBean
}

}

0 comments on commit 47f274a

Please sign in to comment.