Skip to content

Commit 9d45626

Browse files
committed
Fix after review
1 parent 9235d20 commit 9d45626

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/plugin/sarif/TargetClassWrapper.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package org.utbot.framework.plugin.sarif
22

33
import org.utbot.framework.plugin.api.UtMethod
4+
import org.utbot.framework.plugin.api.util.executableId
45
import java.io.File
56
import kotlin.reflect.KCallable
67
import kotlin.reflect.KClass
7-
import kotlin.reflect.KVisibility
88
import kotlin.reflect.jvm.kotlinFunction
99

1010
/**
@@ -22,15 +22,16 @@ data class TargetClassWrapper(
2222
* Returns the methods of the class [classUnderTest] declared by the user.
2323
*/
2424
val targetMethods: List<UtMethod<*>> = run {
25-
val declaredMethods = classUnderTest.java.declaredMethods.map {
26-
UtMethod(it.kotlinFunction as KCallable<*>, classUnderTest)
27-
}
28-
if (testPrivateMethods) {
29-
declaredMethods
25+
val allDeclaredMethods = classUnderTest.java.declaredMethods
26+
val neededDeclaredMethods = if (testPrivateMethods) {
27+
allDeclaredMethods.toList()
3028
} else {
31-
declaredMethods.filter {
32-
it.callable.visibility != KVisibility.PRIVATE
29+
allDeclaredMethods.filter {
30+
!it.executableId.isPrivate
3331
}
3432
}
33+
neededDeclaredMethods.map {
34+
UtMethod(it.kotlinFunction as KCallable<*>, classUnderTest)
35+
}
3536
}
3637
}

0 commit comments

Comments
 (0)