11/*
2- * Copyright 2002-2024 the original author or authors.
2+ * Copyright 2002-2025 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -81,6 +81,12 @@ class BindingReflectionHintsRegistrarKotlinTests {
8181 assertThat(RuntimeHintsPredicates .reflection().onType(SampleClass ::class .java)
8282 .withMemberCategory(MemberCategory .INTROSPECT_DECLARED_METHODS )).accepts(hints)
8383 }
84+
85+ @Test
86+ fun `Register reflection hints on serializer function with parameter` () {
87+ bindingRegistrar.registerReflectionHints(hints.reflection(), SampleResult ::class .java)
88+ assertThat(RuntimeHintsPredicates .reflection().onMethod(SampleResult .Companion ::class .java, " serializer" )).accepts(hints)
89+ }
8490}
8591
8692@kotlinx.serialization.Serializable
@@ -89,3 +95,17 @@ class SampleSerializableClass(val name: String)
8995data class SampleDataClass (val name : String , val isNonNullable : Boolean , val isNullable : Boolean? )
9096
9197class SampleClass (val name : String )
98+
99+ @kotlinx.serialization.Serializable
100+ data class SampleResult <T >(
101+ val code : Int ,
102+ val message : String ,
103+ val data : T ,
104+ ) {
105+ companion object {
106+ private const val SUCCESS : Int = 200
107+ private const val FAILURE : Int = 500
108+ fun <T > success (message : String , data : T ) = SampleResult <T >(code = SUCCESS , message = message, data = data)
109+ fun <T > failure (message : String , data : T ) = SampleResult <T >(code = FAILURE , message = message, data = data)
110+ }
111+ }
0 commit comments