From c9b80463b4a468f0ef9e943eca8da2dcc43f52dd Mon Sep 17 00:00:00 2001 From: Stephan Strate Date: Wed, 4 Dec 2024 15:37:08 +0100 Subject: [PATCH] Register Kotlin's empty set for reflection --- .../java/io/quarkus/kotlin/deployment/KotlinProcessor.java | 4 +++- .../main/kotlin/io/quarkus/it/kotser/GreetingResource.kt | 6 ++++++ .../src/test/kotlin/io/quarkus/it/kotser/ResourceTest.kt | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/extensions/kotlin/deployment/src/main/java/io/quarkus/kotlin/deployment/KotlinProcessor.java b/extensions/kotlin/deployment/src/main/java/io/quarkus/kotlin/deployment/KotlinProcessor.java index aff88dfbd80b2..8a95b61750fe2 100644 --- a/extensions/kotlin/deployment/src/main/java/io/quarkus/kotlin/deployment/KotlinProcessor.java +++ b/extensions/kotlin/deployment/src/main/java/io/quarkus/kotlin/deployment/KotlinProcessor.java @@ -62,7 +62,9 @@ void registerKotlinReflection(final BuildProducer refl reflectiveClass.produce(ReflectiveClassBuildItem.builder("kotlin.KotlinVersion$Companion[]").constructors(false) .build()); reflectiveClass.produce( - ReflectiveClassBuildItem.builder("kotlin.collections.EmptyList", "kotlin.collections.EmptyMap").build()); + ReflectiveClassBuildItem + .builder("kotlin.collections.EmptyList", "kotlin.collections.EmptyMap", "kotlin.collections.EmptySet") + .build()); nativeResourcePatterns.produce(builder().includePatterns( "META-INF/.*.kotlin_module$", diff --git a/integration-tests/kotlin/src/main/kotlin/io/quarkus/it/kotser/GreetingResource.kt b/integration-tests/kotlin/src/main/kotlin/io/quarkus/it/kotser/GreetingResource.kt index a1d0804d563c0..bbf30af7b3626 100644 --- a/integration-tests/kotlin/src/main/kotlin/io/quarkus/it/kotser/GreetingResource.kt +++ b/integration-tests/kotlin/src/main/kotlin/io/quarkus/it/kotser/GreetingResource.kt @@ -85,5 +85,11 @@ class GreetingResource { return emptyMap() } + @GET + @Path("emptySet") + fun emptySet(): Set { + return emptySet() + } + fun reflect() = "hello, world" } diff --git a/integration-tests/kotlin/src/test/kotlin/io/quarkus/it/kotser/ResourceTest.kt b/integration-tests/kotlin/src/test/kotlin/io/quarkus/it/kotser/ResourceTest.kt index 35d43c86e164f..4f50cae5545b5 100644 --- a/integration-tests/kotlin/src/test/kotlin/io/quarkus/it/kotser/ResourceTest.kt +++ b/integration-tests/kotlin/src/test/kotlin/io/quarkus/it/kotser/ResourceTest.kt @@ -134,4 +134,9 @@ open class ResourceTest { fun testEmptyMap() { When { get("/emptyList") } Then { statusCode(200) } } + + @Test + fun testEmptySet() { + When { get("/emptySet") } Then { statusCode(200) } + } }