Skip to content

Commit 32d7a7e

Browse files
authored
Minor refactoring in SimpleCommentBuildr and CustomJavaDocCommentBuilder (#788)
* Minor refactoring in SimpleCommentBuildr and CustomJavaDocCommentBuilder * Minor review fix
1 parent 517c9f6 commit 32d7a7e

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

utbot-summary/src/main/kotlin/org/utbot/summary/comment/CustomJavaDocCommentBuilder.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,11 @@ class CustomJavaDocCommentBuilder(
4545

4646
// builds Throws exception section
4747
val thrownException = traceTag.result.exceptionOrNull()
48-
val exceptionThrow: String? = if (thrownException == null) {
49-
traceTag.result.exceptionOrNull()?.let { it::class.qualifiedName }
50-
} else {
48+
if (thrownException != null) {
5149
val exceptionName = thrownException.javaClass.name
5250
val reason = findExceptionReason(currentMethod, thrownException)
53-
"{@link $exceptionName} $reason"
54-
}
5551

56-
if (exceptionThrow != null) {
57-
customJavaDocComment.throwsException = exceptionThrow
52+
customJavaDocComment.throwsException = "{@link $exceptionName} $reason"
5853
}
5954

6055
// builds Iterates section

utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleCommentBuilder.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,9 @@ open class SimpleCommentBuilder(
5757
root: SimpleSentenceBlock,
5858
currentMethod: SootMethod
5959
) {
60-
val thrownException = traceTag.result.exceptionOrNull()
61-
if (thrownException == null) {
62-
root.exceptionThrow = traceTag.result.exceptionOrNull()?.let { it::class.qualifiedName }
63-
} else {
64-
val exceptionName = thrownException.javaClass.simpleName
65-
val reason = findExceptionReason(currentMethod, thrownException)
60+
traceTag.result.exceptionOrNull()?.let {
61+
val exceptionName = it.javaClass.simpleName
62+
val reason = findExceptionReason(currentMethod, it)
6663
root.exceptionThrow = "$exceptionName $reason"
6764
}
6865
}

0 commit comments

Comments
 (0)