Merge branch '7.0.x'

This commit is contained in:
Sam Brannen
2026-07-02 12:08:26 +02:00
2 changed files with 30 additions and 0 deletions
@@ -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() ||
@@ -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