Skip to content

Commit 3e039e0

Browse files
committed
Apply review comments
1 parent 389b5c2 commit 3e039e0

File tree

2 files changed

+11
-12
lines changed
  • utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/context
  • utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util

2 files changed

+11
-12
lines changed
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package org.utbot.framework.plugin.api.util
22

3-
import org.utbot.framework.plugin.api.ClassId
4-
53
val Throwable.description
64
get() = message?.replace('\n', '\t') ?: "<Throwable with empty message>"
75

86
val Throwable.isCheckedException
9-
get() = !(this is RuntimeException|| this is Error)
7+
get() = !(this is RuntimeException || this is Error)
108

11-
val ClassId.isCheckedException
12-
get() = !(RuntimeException::class.java.isAssignableFrom(this.jClass) || Error::class.java.isAssignableFrom(this.jClass))
9+
val Class<*>.isCheckedException
10+
get() = !(RuntimeException::class.java.isAssignableFrom(this) || Error::class.java.isAssignableFrom(this))

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/context/CgContext.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ import kotlinx.collections.immutable.persistentListOf
5454
import kotlinx.collections.immutable.persistentMapOf
5555
import kotlinx.collections.immutable.persistentSetOf
5656
import org.utbot.framework.codegen.model.constructor.builtin.streamsDeepEqualsMethodId
57-
import org.utbot.framework.plugin.api.util.isSubtypeOf
58-
import org.utbot.framework.plugin.api.util.isNotSubtypeOf
59-
import org.utbot.framework.plugin.api.util.isCheckedException
60-
import org.utbot.framework.plugin.api.util.id
6157
import org.utbot.framework.plugin.api.util.executableId
58+
import org.utbot.framework.plugin.api.util.id
59+
import org.utbot.framework.plugin.api.util.isCheckedException
60+
import org.utbot.framework.plugin.api.util.isNotSubtypeOf
61+
import org.utbot.framework.plugin.api.util.isSubtypeOf
62+
import org.utbot.framework.plugin.api.util.jClass
6263

6364
/**
6465
* Interface for all code generation context aware entities
@@ -240,11 +241,11 @@ internal interface CgContextOwner {
240241
when (exception) {
241242
is BuiltinClassId -> {}
242243
else -> {
243-
if (exception isNotSubtypeOf Throwable::class.id) {
244-
error("Class $exception which is not a Throwable was passed")
244+
require(exception isNotSubtypeOf Throwable::class.id) {
245+
"Class $exception which is not a Throwable was passed"
245246
}
246247

247-
val isUnchecked = !exception.isCheckedException
248+
val isUnchecked = !exception.jClass.isCheckedException
248249
val alreadyAdded =
249250
collectedExceptions.any { existingException -> exception isSubtypeOf existingException }
250251

0 commit comments

Comments
 (0)