Skip to content

Commit

Permalink
kotlin v bump
Browse files Browse the repository at this point in the history
  • Loading branch information
mvysny committed Jul 1, 2024
1 parent b92cc51 commit 07b99d1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 07b99d1

Please sign in to comment.