mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Merge branch '7.0.x'
This commit is contained in:
+1
@@ -46,6 +46,7 @@ public abstract class NativeConfigurationWriter {
|
||||
private boolean hasAnyHint(RuntimeHints hints) {
|
||||
return (hints.proxies().jdkProxyHints().findAny().isPresent() ||
|
||||
hints.reflection().typeHints().findAny().isPresent() ||
|
||||
hints.reflection().lambdaHints().findAny().isPresent() ||
|
||||
hints.resources().resourcePatternHints().findAny().isPresent() ||
|
||||
hints.resources().resourceBundleHints().findAny().isPresent() ||
|
||||
hints.jni().typeHints().findAny().isPresent() ||
|
||||
|
||||
+29
@@ -23,6 +23,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
@@ -137,6 +138,34 @@ class FileNativeConfigurationWriterTests {
|
||||
""");
|
||||
}
|
||||
|
||||
@Test // gh-36989
|
||||
void lambdaConfig() throws Exception {
|
||||
FileNativeConfigurationWriter generator = new FileNativeConfigurationWriter(tempDir);
|
||||
RuntimeHints hints = new RuntimeHints();
|
||||
hints.reflection().registerLambda(Integer.class, builder -> builder
|
||||
.withDeclaringMethod("getCell", Integer.class, Integer.class)
|
||||
.withInterfaces(Supplier.class));
|
||||
generator.write(hints);
|
||||
assertEquals("""
|
||||
{
|
||||
"reflection": [
|
||||
{
|
||||
"type": {
|
||||
"lambda": {
|
||||
"declaringClass": "java.lang.Integer",
|
||||
"declaringMethod": {
|
||||
"name": "getCell",
|
||||
"parameterTypes": [ "java.lang.Integer", "java.lang.Integer" ]
|
||||
},
|
||||
"interfaces": [ "java.util.function.Supplier" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
@Test
|
||||
void jniConfig() throws Exception {
|
||||
// same format as reflection so just test basic file generation
|
||||
|
||||
Reference in New Issue
Block a user