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
This commit is contained in:
parent
3e37279db6
commit
cb849a7071
|
@ -19,6 +19,7 @@ package org.springframework.aop.framework
|
||||||
import org.assertj.core.api.Assertions.assertThat
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
import org.assertj.core.api.Assertions.assertThatThrownBy
|
import org.assertj.core.api.Assertions.assertThatThrownBy
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for Kotlin support in [CglibAopProxy].
|
* Tests for Kotlin support in [CglibAopProxy].
|
||||||
|
@ -48,6 +49,13 @@ class CglibAopProxyKotlinTests {
|
||||||
assertThatThrownBy { proxy.checkedException() }.isInstanceOf(CheckedException::class.java)
|
assertThatThrownBy { proxy.checkedException() }.isInstanceOf(CheckedException::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test // gh-35487
|
||||||
|
fun jvmDefault() {
|
||||||
|
val proxyFactory = ProxyFactory()
|
||||||
|
proxyFactory.setTarget(AddressRepo())
|
||||||
|
proxyFactory.proxy
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
open class MyKotlinBean {
|
open class MyKotlinBean {
|
||||||
|
|
||||||
|
@ -63,4 +71,24 @@ class CglibAopProxyKotlinTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
class CheckedException() : Exception()
|
class CheckedException() : Exception()
|
||||||
|
|
||||||
|
open class AddressRepo(): CrudRepo<Address, Int>
|
||||||
|
|
||||||
|
interface CrudRepo<E : Any, ID : Any> {
|
||||||
|
fun save(e: E): E {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
fun delete(id: ID): Long {
|
||||||
|
return 0L
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Address(
|
||||||
|
val id: Int = 0,
|
||||||
|
val street: String,
|
||||||
|
val version: Int = 0,
|
||||||
|
val createdAt: LocalDateTime? = null,
|
||||||
|
val updatedAt: LocalDateTime? = null,
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue