diff --git a/utbot-framework-api/build.gradle.kts b/utbot-framework-api/build.gradle.kts index 47e85e3bc6..a1ab2c502a 100644 --- a/utbot-framework-api/build.gradle.kts +++ b/utbot-framework-api/build.gradle.kts @@ -5,6 +5,8 @@ val sootVersion: String by rootProject val commonsLangVersion: String by rootProject val kotlinLoggingVersion: String? by rootProject val rdVersion: String? by rootProject +val kryoVersion: String? by rootProject +val kryoSerializersVersion: String? by rootProject plugins { id("com.github.johnrengelman.shadow") version "7.1.2" @@ -22,6 +24,9 @@ dependencies { implementation(group = "io.github.microutils", name = "kotlin-logging", version = kotlinLoggingVersion) // TODO do we really need apache commons? implementation(group = "org.apache.commons", name = "commons-lang3", version = commonsLangVersion) + implementation(group = "com.esotericsoftware.kryo", name = "kryo5", version = kryoVersion) + // this is necessary for serialization of some collections + implementation(group = "de.javakaffee", name = "kryo-serializers", version = kryoSerializersVersion) testImplementation(group = "junit", name = "junit", version = junit4Version) } diff --git a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/KryoHelper.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/process/kryo/KryoHelper.kt similarity index 98% rename from utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/KryoHelper.kt rename to utbot-framework-api/src/main/kotlin/org/utbot/framework/process/kryo/KryoHelper.kt index 368e6c458e..8b6ce2cdbf 100644 --- a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/KryoHelper.kt +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/process/kryo/KryoHelper.kt @@ -1,4 +1,4 @@ -package org.utbot.instrumentation.util +package org.utbot.framework.process.kryo import com.esotericsoftware.kryo.kryo5.Kryo import com.esotericsoftware.kryo.kryo5.SerializerFactory diff --git a/utbot-framework-api/src/main/kotlin/org/utbot/framework/process/kryo/ProcessCommunicationException.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/process/kryo/ProcessCommunicationException.kt new file mode 100644 index 0000000000..53dc6bd623 --- /dev/null +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/process/kryo/ProcessCommunicationException.kt @@ -0,0 +1,9 @@ +package org.utbot.framework.process.kryo + +open class ProcessCommunicationException(msg: String?, cause: Throwable? = null) : Exception(msg, cause) + +class ReadingFromKryoException(e: Throwable) : + ProcessCommunicationException("Reading from Kryo exception |> ${e.stackTraceToString()}", e) + +class WritingToKryoException(e: Throwable) : + ProcessCommunicationException("Writing to Kryo exception |> ${e.stackTraceToString()}", e) \ No newline at end of file diff --git a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/ThrowableSerializer.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/process/kryo/ThrowableSerializer.kt similarity index 99% rename from utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/ThrowableSerializer.kt rename to utbot-framework-api/src/main/kotlin/org/utbot/framework/process/kryo/ThrowableSerializer.kt index 279e1e6348..a645d454fe 100644 --- a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/ThrowableSerializer.kt +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/process/kryo/ThrowableSerializer.kt @@ -1,4 +1,4 @@ -package org.utbot.instrumentation.util +package org.utbot.framework.process.kryo import com.esotericsoftware.kryo.kryo5.Kryo import com.esotericsoftware.kryo.kryo5.KryoException diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt index 9e40d04985..45f9eaf582 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt @@ -29,8 +29,8 @@ import org.utbot.framework.plugin.services.JdkInfo import org.utbot.framework.process.generated.* import org.utbot.framework.process.generated.BeanAdditionalData import org.utbot.framework.process.generated.BeanDefinitionData +import org.utbot.framework.process.kryo.KryoHelper import org.utbot.instrumentation.instrumentation.instrumenter.Instrumenter -import org.utbot.instrumentation.util.KryoHelper import org.utbot.rd.IdleWatchdog import org.utbot.rd.ClientProtocolBuilder import org.utbot.rd.RdSettingsContainerFactory diff --git a/utbot-instrumentation/build.gradle.kts b/utbot-instrumentation/build.gradle.kts index 931fdc857f..6f91243262 100644 --- a/utbot-instrumentation/build.gradle.kts +++ b/utbot-instrumentation/build.gradle.kts @@ -49,9 +49,6 @@ dependencies { implementation("org.ow2.asm:asm:$asmVersion") implementation("org.ow2.asm:asm-commons:$asmVersion") - implementation("com.esotericsoftware.kryo:kryo5:$kryoVersion") - // this is necessary for serialization of some collections - implementation("de.javakaffee:kryo-serializers:$kryoSerializersVersion") implementation("io.github.microutils:kotlin-logging:$kotlinLoggingVersion") implementation("com.jetbrains.rd:rd-framework:$rdVersion") diff --git a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/process/InstrumentedProcessMain.kt b/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/process/InstrumentedProcessMain.kt index c63feb8538..a7cba18234 100644 --- a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/process/InstrumentedProcessMain.kt +++ b/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/process/InstrumentedProcessMain.kt @@ -8,6 +8,7 @@ import org.mockito.Mockito import org.utbot.common.* import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.util.UtContext +import org.utbot.framework.process.kryo.KryoHelper import org.utbot.instrumentation.agent.Agent import org.utbot.instrumentation.instrumentation.Instrumentation import org.utbot.instrumentation.instrumentation.coverage.CoverageInstrumentation @@ -19,7 +20,6 @@ import org.utbot.instrumentation.process.generated.GetSpringRepositoriesResult import org.utbot.instrumentation.process.generated.InstrumentedProcessModel import org.utbot.instrumentation.process.generated.InvokeMethodCommandResult import org.utbot.instrumentation.process.generated.instrumentedProcessModel -import org.utbot.instrumentation.util.KryoHelper import org.utbot.rd.IdleWatchdog import org.utbot.rd.ClientProtocolBuilder import org.utbot.rd.RdSettingsContainerFactory diff --git a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/rd/InstrumentedProcess.kt b/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/rd/InstrumentedProcess.kt index 783f984cc9..7ec82ef285 100644 --- a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/rd/InstrumentedProcess.kt +++ b/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/rd/InstrumentedProcess.kt @@ -10,6 +10,8 @@ import org.utbot.framework.UtSettings import org.utbot.framework.plugin.api.UtModel import org.utbot.framework.plugin.services.WorkingDirService import org.utbot.framework.process.AbstractRDProcessCompanion +import org.utbot.framework.process.kryo.KryoHelper +import org.utbot.instrumentation.agent.DynamicClassTransformer import org.utbot.instrumentation.instrumentation.Instrumentation import org.utbot.instrumentation.process.DISABLE_SANDBOX_OPTION import org.utbot.instrumentation.process.generated.AddPathsParams @@ -17,7 +19,6 @@ import org.utbot.instrumentation.process.generated.GetSpringBeanParams import org.utbot.instrumentation.process.generated.InstrumentedProcessModel import org.utbot.instrumentation.process.generated.SetInstrumentationParams import org.utbot.instrumentation.process.generated.instrumentedProcessModel -import org.utbot.instrumentation.util.KryoHelper import org.utbot.rd.ProcessWithRdServer import org.utbot.rd.exceptions.InstantProcessDeathException import org.utbot.rd.generated.LoggerModel diff --git a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/InstrumentationException.kt b/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/InstrumentationException.kt index 6ab36d3ea3..8a617f0168 100644 --- a/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/InstrumentationException.kt +++ b/utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/InstrumentationException.kt @@ -20,12 +20,6 @@ class NoProbesArrayException(clazz: Class<*>, arrayName: String) : class CastProbesArrayException : InstrumentationException("Can't cast probes array to Boolean array") -class ReadingFromKryoException(e: Throwable) : - InstrumentationException("Reading from Kryo exception |> ${e.stackTraceToString()}", e) - -class WritingToKryoException(e: Throwable) : - InstrumentationException("Writing to Kryo exception |> ${e.stackTraceToString()}", e) - /** * this exception is thrown only in main process. * currently it means that {e: Throwable} happened in instrumented process, diff --git a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt index 9f6ab4abe7..2dbc7f9ef4 100644 --- a/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt +++ b/utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt @@ -25,9 +25,9 @@ import org.utbot.framework.plugin.services.WorkingDirService import org.utbot.framework.process.AbstractRDProcessCompanion import org.utbot.framework.process.generated.* import org.utbot.framework.process.generated.MethodDescription +import org.utbot.framework.process.kryo.KryoHelper import org.utbot.framework.util.Conflict import org.utbot.framework.util.ConflictTriggers -import org.utbot.instrumentation.util.KryoHelper import org.utbot.intellij.plugin.UtbotBundle import org.utbot.intellij.plugin.models.GenerateTestsModel import org.utbot.intellij.plugin.ui.TestReportUrlOpeningListener