@@ -54,11 +54,11 @@ import kotlinx.collections.immutable.persistentListOf
5454import  kotlinx.collections.immutable.persistentMapOf 
5555import  kotlinx.collections.immutable.persistentSetOf 
5656import  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 
6157import  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.isSubtypeOf 
61+ import  org.utbot.framework.plugin.api.util.jClass 
6262
6363/* *
6464 * Interface for all code generation context aware entities 
@@ -237,22 +237,19 @@ internal interface CgContextOwner {
237237    }
238238
239239    fun  addExceptionIfNeeded (exception :  ClassId ) {
240-         when  (exception) {
241-             is  BuiltinClassId  ->  {}
242-             else  ->  {
243-                 if  (exception isNotSubtypeOf Throwable ::class .id) {
244-                     error(" Class $exception  which is not a Throwable was passed" 
245-                 }
240+         if  (exception !is  BuiltinClassId ) {
241+             require(exception isSubtypeOf Throwable ::class .id) {
242+                 " Class $exception  which is not a Throwable was passed" 
243+             }
246244
247-                  val  isUnchecked =  ! exception.isCheckedException
248-                  val  alreadyAdded = 
249-                      collectedExceptions.any { existingException ->  exception isSubtypeOf existingException }
245+             val  isUnchecked =  ! exception.jClass .isCheckedException
246+             val  alreadyAdded = 
247+                 collectedExceptions.any { existingException ->  exception isSubtypeOf existingException }
250248
251-                  if  (isUnchecked ||  alreadyAdded) return 
249+             if  (isUnchecked ||  alreadyAdded) return 
252250
253-                 collectedExceptions
254-                     .removeIf { existingException ->  existingException isSubtypeOf exception }
255-             }
251+             collectedExceptions
252+                 .removeIf { existingException ->  existingException isSubtypeOf exception }
256253        }
257254
258255        if  (collectedExceptions.add(exception)) {
0 commit comments