Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix after review
  • Loading branch information
mmvpm committed Jul 13, 2022
commit b740a5203401a5429b149dd985f7bcce344cd2e0
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.utbot.framework.plugin.sarif

import org.utbot.framework.plugin.api.UtMethod
import org.utbot.framework.plugin.api.util.executableId
import java.io.File
import kotlin.reflect.KCallable
import kotlin.reflect.KClass
import kotlin.reflect.KVisibility
import kotlin.reflect.jvm.kotlinFunction

/**
Expand All @@ -22,15 +22,16 @@ data class TargetClassWrapper(
* Returns the methods of the class [classUnderTest] declared by the user.
*/
val targetMethods: List<UtMethod<*>> = run {
val declaredMethods = classUnderTest.java.declaredMethods.map {
UtMethod(it.kotlinFunction as KCallable<*>, classUnderTest)
}
if (testPrivateMethods) {
declaredMethods
val allDeclaredMethods = classUnderTest.java.declaredMethods
val neededDeclaredMethods = if (testPrivateMethods) {
allDeclaredMethods.toList()
} else {
declaredMethods.filter {
it.callable.visibility != KVisibility.PRIVATE
allDeclaredMethods.filter {
!it.executableId.isPrivate
}
}
neededDeclaredMethods.map {
UtMethod(it.kotlinFunction as KCallable<*>, classUnderTest)
}
}
}