Skip to content

Commit

Permalink
Register Kotlin's empty list and map for reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Nov 14, 2024
1 parent 90b6e9b commit 15232bf
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 15232bf

Please sign in to comment.