Skip to content

Commit cb849a7

Browse files
committed
Add a test for CGLIB Enhancer Kotlin refinements
This commit adds a reproducer for the change of behavior introduced via https://youtrack.jetbrains.com/issue/KT-76667. The test is only broken with Kotlin 2.2.20+ without the related fix (see previous commit). Closes gh-35487
1 parent 3e37279 commit cb849a7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

spring-aop/src/test/kotlin/org/springframework/aop/framework/CglibAopProxyKotlinTests.kt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package org.springframework.aop.framework
1919
import org.assertj.core.api.Assertions.assertThat
2020
import org.assertj.core.api.Assertions.assertThatThrownBy
2121
import org.junit.jupiter.api.Test
22+
import java.time.LocalDateTime
2223

2324
/**
2425
* Tests for Kotlin support in [CglibAopProxy].
@@ -48,6 +49,13 @@ class CglibAopProxyKotlinTests {
4849
assertThatThrownBy { proxy.checkedException() }.isInstanceOf(CheckedException::class.java)
4950
}
5051

52+
@Test // gh-35487
53+
fun jvmDefault() {
54+
val proxyFactory = ProxyFactory()
55+
proxyFactory.setTarget(AddressRepo())
56+
proxyFactory.proxy
57+
}
58+
5159

5260
open class MyKotlinBean {
5361

@@ -63,4 +71,24 @@ class CglibAopProxyKotlinTests {
6371
}
6472

6573
class CheckedException() : Exception()
74+
75+
open class AddressRepo(): CrudRepo<Address, Int>
76+
77+
interface CrudRepo<E : Any, ID : Any> {
78+
fun save(e: E): E {
79+
return e
80+
}
81+
fun delete(id: ID): Long {
82+
return 0L
83+
}
84+
}
85+
86+
data class Address(
87+
val id: Int = 0,
88+
val street: String,
89+
val version: Int = 0,
90+
val createdAt: LocalDateTime? = null,
91+
val updatedAt: LocalDateTime? = null,
92+
)
93+
6694
}

0 commit comments

Comments
 (0)