Skip to content

Minor refactoring in SimpleCommentBuildr and CustomJavaDocCommentBuilder #788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,11 @@ class CustomJavaDocCommentBuilder(

// builds Throws exception section
val thrownException = traceTag.result.exceptionOrNull()
val exceptionThrow: String? = if (thrownException == null) {
traceTag.result.exceptionOrNull()?.let { it::class.qualifiedName }
} else {
if (thrownException != null) {
val exceptionName = thrownException.javaClass.name
val reason = findExceptionReason(currentMethod, thrownException)
"{@link $exceptionName} $reason"
}

if (exceptionThrow != null) {
customJavaDocComment.throwsException = exceptionThrow
customJavaDocComment.throwsException = "{@link $exceptionName} $reason"
}

// builds Iterates section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@ open class SimpleCommentBuilder(
root: SimpleSentenceBlock,
currentMethod: SootMethod
) {
val thrownException = traceTag.result.exceptionOrNull()
if (thrownException == null) {
root.exceptionThrow = traceTag.result.exceptionOrNull()?.let { it::class.qualifiedName }
} else {
val exceptionName = thrownException.javaClass.simpleName
val reason = findExceptionReason(currentMethod, thrownException)
traceTag.result.exceptionOrNull()?.let {
val exceptionName = it.javaClass.simpleName
val reason = findExceptionReason(currentMethod, it)
root.exceptionThrow = "$exceptionName $reason"
}
}
Expand Down