Skip to content

Commit dadb91b

Browse files
authored
Built the link to the nested class for the JavaDocs (#1395)
* Built the link to the nested class for the JavaDocs * Merged with the existing master
1 parent da3ea23 commit dadb91b

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ class UtBotSymbolicEngine(
432432
val methodUnderTestDescription = FuzzedMethodDescription(methodUnderTest, collectConstantsForFuzzer(graph)).apply {
433433
compilableName = if (!methodUnderTest.isConstructor) methodUnderTest.name else null
434434
className = classUnderTest.simpleName
435+
canonicalName = classUnderTest.canonicalName
436+
isNested = classUnderTest.isNested
435437
packageName = classUnderTest.packageName
436438
val names = graph.body.method.tags.filterIsInstance<ParamNamesTag>().firstOrNull()?.names
437439
parameterNameMap = { index -> names?.getOrNull(index) }

utbot-fuzzers/src/main/kotlin/org/utbot/fuzzer/FuzzedMethodDescription.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ open class FuzzedMethodDescription(
1919
val parameters: List<ClassId>,
2020
val concreteValues: Collection<FuzzedConcreteValue> = emptyList()
2121
) {
22-
2322
/**
2423
* Name that can be used to generate test names
2524
*/
@@ -35,6 +34,16 @@ open class FuzzedMethodDescription(
3534
*/
3635
var packageName: String? = null
3736

37+
/**
38+
* Canonical name.
39+
*/
40+
var canonicalName: String? = null
41+
42+
/**
43+
* True, if class is nested.
44+
*/
45+
var isNested: Boolean = false
46+
3847
/**
3948
* Returns parameter name by its index in the signature
4049
*/

utbot-summary/src/main/kotlin/org/utbot/summary/comment/classic/fuzzer/SimpleCommentForTestProducedByFuzzerBuilder.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ class SimpleCommentForTestProducedByFuzzerBuilder(
2020
val packageName = methodDescription.packageName
2121
val className = methodDescription.className
2222
val methodName = methodDescription.compilableName
23+
val canonicalName = methodDescription.canonicalName
24+
val isNested = methodDescription.isNested
2325

2426
val result = if (packageName != null && className != null && methodName != null) {
25-
val fullClassName = getFullClassName(packageName, className)
27+
val fullClassName = getFullClassName(canonicalName, packageName, className, isNested)
2628

2729
val methodReference = getMethodReferenceForFuzzingTest(
2830
fullClassName,

utbot-summary/src/main/kotlin/org/utbot/summary/comment/customtags/CustomTagsUtil.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ fun getClassReference(fullClassName: String): String {
7575
}
7676

7777
/** Returns correct full class name. */
78-
fun getFullClassName(packageName: String, className: String): String {
79-
return if (packageName.isEmpty()) className else "$packageName.$className"
78+
fun getFullClassName(canonicalName: String?, packageName: String, className: String, isNested: Boolean): String {
79+
return if (isNested && canonicalName != null) {
80+
canonicalName
81+
} else {
82+
if (packageName.isEmpty()) className else "$packageName.$className"
83+
}
8084
}

utbot-summary/src/main/kotlin/org/utbot/summary/comment/customtags/fuzzer/CommentWithCustomTagForTestProducedByFuzzerBuilder.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import org.utbot.framework.plugin.api.DocStatement
55
import org.utbot.framework.plugin.api.UtExecutionResult
66
import org.utbot.fuzzer.FuzzedMethodDescription
77
import org.utbot.fuzzer.FuzzedValue
8-
import org.utbot.summary.SummarySentenceConstants.CARRIAGE_RETURN
98
import org.utbot.summary.comment.customtags.getClassReference
109
import org.utbot.summary.comment.customtags.getFullClassName
1110
import org.utbot.summary.comment.customtags.getMethodReferenceForFuzzingTest
@@ -34,9 +33,11 @@ class CommentWithCustomTagForTestProducedByFuzzerBuilder(
3433
val packageName = methodDescription.packageName
3534
val className = methodDescription.className
3635
val methodName = methodDescription.compilableName
36+
val canonicalName = methodDescription.canonicalName
37+
val isNested = methodDescription.isNested
3738

3839
return if (packageName != null && className != null && methodName != null) {
39-
val fullClassName = getFullClassName(packageName, className)
40+
val fullClassName = getFullClassName(canonicalName, packageName, className, isNested)
4041

4142
val methodReference = getMethodReferenceForFuzzingTest(
4243
fullClassName,

0 commit comments

Comments
 (0)