Skip to content

Commit

Permalink
Upgrade jacodb: fix type names (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saloed authored Feb 18, 2025
1 parent df9c103 commit 02e58ea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object Versions {
const val clikt = "5.0.0"
const val detekt = "1.23.7"
const val ini4j = "0.5.4"
const val jacodb = "ad9d0475be"
const val jacodb = "453ec7c0b3"
const val juliet = "1.3.2"
const val junit = "5.9.3"
const val kotlin = "2.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ class TraceHelper(
private fun createJcVirtualMethod(jMethod: Method): JcVirtualMethod = JcVirtualMethodImpl(
name = jMethod.name,
access = jMethod.modifiers,
returnType = TypeNameImpl(jMethod.returnType.name),
returnType = TypeNameImpl.fromTypeName(jMethod.returnType.name),
parameters = createJcVirtualMethodParams(jMethod),
description = ""
)

private fun createJcVirtualMethodParams(jMethod: Method): List<JcVirtualParameter> =
jMethod.parameters.mapIndexed { i, p -> JcVirtualParameter(i, TypeNameImpl(p.type.typeName)) }
jMethod.parameters.mapIndexed { i, p -> JcVirtualParameter(i, TypeNameImpl.fromTypeName(p.type.typeName)) }

/**
* This method create instrumenting method call to insert it in instruction list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ fun JcClasspath.findFieldByFullNameOrNull(fieldFullName: String): JcField? {
operator fun JcClasspath.get(klass: Class<*>) = this.findClassOrNull(klass.name)

val JcClassOrInterface.typename
get() = TypeNameImpl(this.name)

val JcMethod.typename
get() = TypeNameImpl(this.name)

val JcTypedMethod.typename
get() = TypeNameImpl(this.name)
get() = TypeNameImpl.fromTypeName(this.name)

fun JcType.toStringType(): String =
when (this) {
Expand All @@ -40,7 +34,7 @@ fun JcType.toStringType(): String =
else -> typeName
}

fun JcType.getTypename() = TypeNameImpl(this.typeName)
fun JcType.getTypename() = TypeNameImpl.fromTypeName(this.typeName)

val JcInst.enclosingClass
get() = this.location.method.enclosingClass
Expand Down

0 comments on commit 02e58ea

Please sign in to comment.