Polish "Adapt FieldHint to recent GraalVM versions"

See gh-29130
This commit is contained in:
Stephane Nicoll
2022-09-10 15:56:26 +02:00
parent 1cb5f00723
commit 042a4f3518
16 changed files with 49 additions and 388 deletions

View File

@@ -87,7 +87,7 @@ class InjectionCodeGeneratorTests {
TestBean bean = new TestBean();
Field field = ReflectionUtils.findField(bean.getClass(), "age");
this.generator.generateInjectionCode(field, INSTANCE_VARIABLE, CodeBlock.of("$L", 123));
assertThat(RuntimeHintsPredicates.reflection().onField(TestBean.class, "age").withWriteMode())
assertThat(RuntimeHintsPredicates.reflection().onField(TestBean.class, "age"))
.accepts(this.hints);
}

View File

@@ -32,7 +32,6 @@ import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aot.hint.FieldMode;
import org.springframework.aot.hint.TypeReference;
import org.springframework.aot.test.generate.TestGenerationContext;
import org.springframework.aot.test.generate.compile.CompileWithTargetClassAccess;
@@ -129,13 +128,8 @@ class PersistenceAnnotationBeanPostProcessorAotContributionTests {
.singleElement().satisfies(typeHint -> {
assertThat(typeHint.getType()).isEqualTo(
TypeReference.of(DefaultPersistenceContextField.class));
assertThat(typeHint.fields()).singleElement()
.satisfies(fieldHint -> {
assertThat(fieldHint.getName())
.isEqualTo("entityManager");
assertThat(fieldHint.getMode()).isEqualTo(FieldMode.WRITE);
assertThat(fieldHint.isAllowUnsafeAccess()).isFalse();
});
assertThat(typeHint.fields()).singleElement().satisfies(fieldHint ->
assertThat(fieldHint.getName()).isEqualTo("entityManager"));
});
});
}