Skip to content

Commit 98da8de

Browse files
authored
Fixed wrong links in JavaDocs for classes with empty package (#1317)
Added a solution
1 parent d242a1a commit 98da8de

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.utbot.fuzzer.FuzzedMethodDescription
88
import org.utbot.fuzzer.FuzzedValue
99
import org.utbot.summary.SummarySentenceConstants.NEW_LINE
1010
import org.utbot.summary.comment.customtags.getClassReference
11+
import org.utbot.summary.comment.customtags.getFullClassName
1112
import org.utbot.summary.comment.customtags.getMethodReferenceForFuzzingTest
1213

1314
class SimpleCommentForTestProducedByFuzzerBuilder(
@@ -21,7 +22,7 @@ class SimpleCommentForTestProducedByFuzzerBuilder(
2122
val methodName = methodDescription.compilableName
2223

2324
val result = if (packageName != null && className != null && methodName != null) {
24-
val fullClassName = "$packageName.$className"
25+
val fullClassName = getFullClassName(packageName, className)
2526

2627
val methodReference = getMethodReferenceForFuzzingTest(
2728
fullClassName,

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,9 @@ private fun formMethodReferenceForJavaDoc(
7272
*/
7373
fun getClassReference(fullClassName: String): String {
7474
return "{@link ${fullClassName.replace(JAVA_CLASS_DELIMITER, JAVA_DOC_CLASS_DELIMITER)}}".replace(CARRIAGE_RETURN, EMPTY_STRING)
75+
}
76+
77+
/** Returns correct full class name. */
78+
fun getFullClassName(packageName: String, className: String): String {
79+
return if (packageName.isEmpty()) className else "$packageName.$className"
7580
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.utbot.fuzzer.FuzzedMethodDescription
77
import org.utbot.fuzzer.FuzzedValue
88
import org.utbot.summary.SummarySentenceConstants.CARRIAGE_RETURN
99
import org.utbot.summary.comment.customtags.getClassReference
10+
import org.utbot.summary.comment.customtags.getFullClassName
1011
import org.utbot.summary.comment.customtags.getMethodReferenceForFuzzingTest
1112
import org.utbot.summary.comment.customtags.symbolic.CustomJavaDocTagProvider
1213

@@ -35,7 +36,7 @@ class CommentWithCustomTagForTestProducedByFuzzerBuilder(
3536
val methodName = methodDescription.compilableName
3637

3738
return if (packageName != null && className != null && methodName != null) {
38-
val fullClassName = "$packageName.$className"
39+
val fullClassName = getFullClassName(packageName, className)
3940

4041
val methodReference = getMethodReferenceForFuzzingTest(
4142
fullClassName,

0 commit comments

Comments
 (0)