Skip to content

Commit 93be3c2

Browse files
Move KryoHelper to use it for different processes communication (#2202)
1 parent 802e919 commit 93be3c2

File tree

10 files changed

+21
-15
lines changed

10 files changed

+21
-15
lines changed

utbot-framework-api/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ val sootVersion: String by rootProject
55
val commonsLangVersion: String by rootProject
66
val kotlinLoggingVersion: String? by rootProject
77
val rdVersion: String? by rootProject
8+
val kryoVersion: String? by rootProject
9+
val kryoSerializersVersion: String? by rootProject
810

911
plugins {
1012
id("com.github.johnrengelman.shadow") version "7.1.2"
@@ -22,6 +24,9 @@ dependencies {
2224
implementation(group = "io.github.microutils", name = "kotlin-logging", version = kotlinLoggingVersion)
2325
// TODO do we really need apache commons?
2426
implementation(group = "org.apache.commons", name = "commons-lang3", version = commonsLangVersion)
27+
implementation(group = "com.esotericsoftware.kryo", name = "kryo5", version = kryoVersion)
28+
// this is necessary for serialization of some collections
29+
implementation(group = "de.javakaffee", name = "kryo-serializers", version = kryoSerializersVersion)
2530
testImplementation(group = "junit", name = "junit", version = junit4Version)
2631
}
2732

utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/KryoHelper.kt renamed to utbot-framework-api/src/main/kotlin/org/utbot/framework/process/kryo/KryoHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.utbot.instrumentation.util
1+
package org.utbot.framework.process.kryo
22

33
import com.esotericsoftware.kryo.kryo5.Kryo
44
import com.esotericsoftware.kryo.kryo5.SerializerFactory
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.utbot.framework.process.kryo
2+
3+
open class ProcessCommunicationException(msg: String?, cause: Throwable? = null) : Exception(msg, cause)
4+
5+
class ReadingFromKryoException(e: Throwable) :
6+
ProcessCommunicationException("Reading from Kryo exception |> ${e.stackTraceToString()}", e)
7+
8+
class WritingToKryoException(e: Throwable) :
9+
ProcessCommunicationException("Writing to Kryo exception |> ${e.stackTraceToString()}", e)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.utbot.instrumentation.util
1+
package org.utbot.framework.process.kryo
22

33
import com.esotericsoftware.kryo.kryo5.Kryo
44
import com.esotericsoftware.kryo.kryo5.KryoException

utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import org.utbot.framework.plugin.services.JdkInfo
2929
import org.utbot.framework.process.generated.*
3030
import org.utbot.framework.process.generated.BeanAdditionalData
3131
import org.utbot.framework.process.generated.BeanDefinitionData
32+
import org.utbot.framework.process.kryo.KryoHelper
3233
import org.utbot.instrumentation.instrumentation.instrumenter.Instrumenter
33-
import org.utbot.instrumentation.util.KryoHelper
3434
import org.utbot.rd.IdleWatchdog
3535
import org.utbot.rd.ClientProtocolBuilder
3636
import org.utbot.rd.RdSettingsContainerFactory

utbot-instrumentation/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ dependencies {
4949

5050
implementation("org.ow2.asm:asm:$asmVersion")
5151
implementation("org.ow2.asm:asm-commons:$asmVersion")
52-
implementation("com.esotericsoftware.kryo:kryo5:$kryoVersion")
53-
// this is necessary for serialization of some collections
54-
implementation("de.javakaffee:kryo-serializers:$kryoSerializersVersion")
5552
implementation("io.github.microutils:kotlin-logging:$kotlinLoggingVersion")
5653

5754
implementation("com.jetbrains.rd:rd-framework:$rdVersion")

utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/process/InstrumentedProcessMain.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.mockito.Mockito
88
import org.utbot.common.*
99
import org.utbot.framework.plugin.api.ClassId
1010
import org.utbot.framework.plugin.api.util.UtContext
11+
import org.utbot.framework.process.kryo.KryoHelper
1112
import org.utbot.instrumentation.agent.Agent
1213
import org.utbot.instrumentation.instrumentation.Instrumentation
1314
import org.utbot.instrumentation.instrumentation.coverage.CoverageInstrumentation
@@ -19,7 +20,6 @@ import org.utbot.instrumentation.process.generated.GetSpringRepositoriesResult
1920
import org.utbot.instrumentation.process.generated.InstrumentedProcessModel
2021
import org.utbot.instrumentation.process.generated.InvokeMethodCommandResult
2122
import org.utbot.instrumentation.process.generated.instrumentedProcessModel
22-
import org.utbot.instrumentation.util.KryoHelper
2323
import org.utbot.rd.IdleWatchdog
2424
import org.utbot.rd.ClientProtocolBuilder
2525
import org.utbot.rd.RdSettingsContainerFactory

utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/rd/InstrumentedProcess.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import org.utbot.framework.UtSettings
1010
import org.utbot.framework.plugin.api.UtModel
1111
import org.utbot.framework.plugin.services.WorkingDirService
1212
import org.utbot.framework.process.AbstractRDProcessCompanion
13+
import org.utbot.framework.process.kryo.KryoHelper
14+
import org.utbot.instrumentation.agent.DynamicClassTransformer
1315
import org.utbot.instrumentation.instrumentation.Instrumentation
1416
import org.utbot.instrumentation.process.DISABLE_SANDBOX_OPTION
1517
import org.utbot.instrumentation.process.generated.AddPathsParams
1618
import org.utbot.instrumentation.process.generated.GetSpringBeanParams
1719
import org.utbot.instrumentation.process.generated.InstrumentedProcessModel
1820
import org.utbot.instrumentation.process.generated.SetInstrumentationParams
1921
import org.utbot.instrumentation.process.generated.instrumentedProcessModel
20-
import org.utbot.instrumentation.util.KryoHelper
2122
import org.utbot.rd.ProcessWithRdServer
2223
import org.utbot.rd.exceptions.InstantProcessDeathException
2324
import org.utbot.rd.generated.LoggerModel

utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/util/InstrumentationException.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ class NoProbesArrayException(clazz: Class<*>, arrayName: String) :
2020
class CastProbesArrayException :
2121
InstrumentationException("Can't cast probes array to Boolean array")
2222

23-
class ReadingFromKryoException(e: Throwable) :
24-
InstrumentationException("Reading from Kryo exception |> ${e.stackTraceToString()}", e)
25-
26-
class WritingToKryoException(e: Throwable) :
27-
InstrumentationException("Writing to Kryo exception |> ${e.stackTraceToString()}", e)
28-
2923
/**
3024
* this exception is thrown only in main process.
3125
* currently it means that {e: Throwable} happened in instrumented process,

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import org.utbot.framework.plugin.services.WorkingDirService
2525
import org.utbot.framework.process.AbstractRDProcessCompanion
2626
import org.utbot.framework.process.generated.*
2727
import org.utbot.framework.process.generated.MethodDescription
28+
import org.utbot.framework.process.kryo.KryoHelper
2829
import org.utbot.framework.util.Conflict
2930
import org.utbot.framework.util.ConflictTriggers
30-
import org.utbot.instrumentation.util.KryoHelper
3131
import org.utbot.intellij.plugin.UtbotBundle
3232
import org.utbot.intellij.plugin.models.GenerateTestsModel
3333
import org.utbot.intellij.plugin.ui.TestReportUrlOpeningListener

0 commit comments

Comments
 (0)