Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.utbot.examples.mixed

import org.junit.jupiter.api.Test
import org.utbot.framework.plugin.api.CodegenLanguage
import org.utbot.testcheckers.eq
import org.utbot.testing.DoNotCalculate
import org.utbot.testing.UtValueTestCaseChecker

internal class SerializableExampleTest : UtValueTestCaseChecker(testClass = SerializableExample::class) {

@Test
fun testExample() {
check(
SerializableExample::example,
eq(1),
)
}
}
19 changes: 13 additions & 6 deletions utbot-framework/src/main/kotlin/org/utbot/engine/Hierarchy.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.utbot.engine

import org.utbot.engine.types.OBJECT_TYPE
import org.utbot.engine.types.TypeRegistry
import org.utbot.framework.plugin.api.ClassId
import org.utbot.framework.plugin.api.id
Expand Down Expand Up @@ -54,14 +55,20 @@ class Hierarchy(private val typeRegistry: TypeRegistry) {

private fun findAncestors(id: ClassId) =
with(Scene.v().getSootClass(id.name)) {
if (this.isInterface) {
Scene.v().activeHierarchy.getSuperinterfacesOfIncluding(this)
val superClasses = mutableListOf<SootClass>()
val superInterfaces = mutableListOf<SootClass>()

if (isInterface) {
superClasses += OBJECT_TYPE.sootClass
superInterfaces += Scene.v().activeHierarchy.getSuperinterfacesOfIncluding(this)
} else {
Scene.v().activeHierarchy.getSuperclassesOfIncluding(this) +
this.interfaces.flatMap {
Scene.v().activeHierarchy.getSuperinterfacesOfIncluding(it)
}
superClasses += Scene.v().activeHierarchy.getSuperclassesOfIncluding(this)
superInterfaces += superClasses
.flatMap { it.interfaces }
.flatMap { Scene.v().activeHierarchy.getSuperinterfacesOfIncluding(it) }
}

superClasses + superInterfaces
}

private fun findInheritors(id: ClassId) =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.utbot.examples.mixed;

import java.io.File;

public class SerializableExample {
public void example() {
join("string", File.separator, System.currentTimeMillis());
}

public static <T> String join(T... elements) {
return null;
}
}