diff --git a/build.gradle.kts b/build.gradle.kts index fb4aa094..1fc099d2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.9.23" // can't v-bump until this is fixed: https://youtrack.jetbrains.com/issue/KT-68361/Function0-not-serializable + kotlin("jvm") version "2.0.0" `maven-publish` signing } diff --git a/karibu-testing-v10/kt10-tests/src/main/kotlin/com/github/mvysny/kaributesting/v10/MockVaadinTest.kt b/karibu-testing-v10/kt10-tests/src/main/kotlin/com/github/mvysny/kaributesting/v10/MockVaadinTest.kt index 69d991f7..cde521f9 100644 --- a/karibu-testing-v10/kt10-tests/src/main/kotlin/com/github/mvysny/kaributesting/v10/MockVaadinTest.kt +++ b/karibu-testing-v10/kt10-tests/src/main/kotlin/com/github/mvysny/kaributesting/v10/MockVaadinTest.kt @@ -83,6 +83,7 @@ internal fun DynaNodeGroup.mockVaadinTest() { } test("serializable") { + System.setProperty("sun.io.serialization.extendedDebugInfo", "true") // https://mvysny.github.io/NotSerializableException/ UI.getCurrent().cloneBySerialization() VaadinSession.getCurrent().cloneBySerialization() // even that it says it's Serializable it's really not. diff --git a/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/MockVaadin.kt b/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/MockVaadin.kt index 50627378..15cc249b 100644 --- a/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/MockVaadin.kt +++ b/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/MockVaadin.kt @@ -63,9 +63,9 @@ public object MockVaadin { @JvmStatic @JvmOverloads public fun setup(routes: Routes = Routes(), - uiFactory: () -> UI = { MockedUI() }) { + uiFactory: () -> UI = @JvmSerializableLambda { MockedUI() }) { // init servlet - val servlet = MockVaadinServlet(routes) + val servlet = MockVaadinServlet(routes, uiFactory) setup(uiFactory, servlet) } @@ -86,7 +86,7 @@ public object MockVaadin { * on what methods you must override in your custom service. */ @JvmStatic - public fun setup(uiFactory: () -> UI = { MockedUI() }, servlet: VaadinServlet) { + public fun setup(uiFactory: () -> UI = @JvmSerializableLambda { MockedUI() }, servlet: VaadinServlet) { check(VaadinVersion.get.isAtLeast(24)) { "Karibu-Testing 2.x only works with Vaadin 24+ but you're using ${VaadinVersion.get}" } diff --git a/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/mock/MockService.kt b/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/mock/MockService.kt index 133ef46b..03250f2e 100644 --- a/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/mock/MockService.kt +++ b/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/mock/MockService.kt @@ -19,7 +19,7 @@ import com.vaadin.flow.server.VaadinSession */ public open class MockService(servlet: VaadinServlet, deploymentConfiguration: DeploymentConfiguration, - public val uiFactory: () -> UI = { MockedUI() } + public val uiFactory: () -> UI = @JvmSerializableLambda { MockedUI() } ) : VaadinServletService(servlet, deploymentConfiguration) { // need to have this override. Setting `VaadinService.atmosphereAvailable` to false via // reflection after the servlet has been initialized is too late, since Atmo is initialized diff --git a/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/mock/MockVaadinServlet.kt b/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/mock/MockVaadinServlet.kt index 9ee14ac0..d69aa1e7 100644 --- a/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/mock/MockVaadinServlet.kt +++ b/karibu-testing-v10/src/main/kotlin/com/github/mvysny/kaributesting/v10/mock/MockVaadinServlet.kt @@ -18,7 +18,7 @@ import java.lang.reflect.Method */ public open class MockVaadinServlet @JvmOverloads constructor( public val routes: Routes = Routes(), - public val uiFactory: () -> UI = { MockedUI() } + public val uiFactory: () -> UI = @JvmSerializableLambda { MockedUI() } ) : VaadinServlet() { @Throws(ServletException::class)