Skip to content

Commit

Permalink
Merge pull request quarkusio#44494 from geoand/quarkusio#44472
Browse files Browse the repository at this point in the history
Register Kotlin's empty list and map for reflection
  • Loading branch information
gsmet authored Nov 14, 2024
2 parents b3ce48d + 15232bf commit 9248a80
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ void registerKotlinReflection(final BuildProducer<ReflectiveClassBuildItem> refl
.build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder("kotlin.KotlinVersion$Companion[]").constructors(false)
.build());
reflectiveClass.produce(
ReflectiveClassBuildItem.builder("kotlin.collections.EmptyList", "kotlin.collections.EmptyMap").build());

nativeResourcePatterns.produce(builder().includePatterns(
"META-INF/.*.kotlin_module$",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,17 @@ class GreetingResource {
return Response.ok().entity(javaMethod.invoke(this)).build()
}

@GET
@Path("emptyList")
fun emptyList(): List<String> {
return emptyList<String>()
}

@GET
@Path("emptyMap")
fun emptyMap(): Map<String, String> {
return emptyMap<String, String>()
}

fun reflect() = "hello, world"
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,14 @@ open class ResourceTest {
body(CoreMatchers.equalTo("hello, world"))
}
}

@Test
fun testEmptyList() {
When { get("/emptyList") } Then { statusCode(200) }
}

@Test
fun testEmptyMap() {
When { get("/emptyList") } Then { statusCode(200) }
}
}

0 comments on commit 9248a80

Please sign in to comment.