diff options
author | Linnea Gräf <nea@nea.moe> | 2024-07-31 21:20:49 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-07-31 21:20:49 +0200 |
commit | 64f615806b4f21998cdc3da0885ad9958d4de369 (patch) | |
tree | 1859ca9c0c3adc89367e47bb18797fe07363d7b4 /src/main/kotlin | |
parent | 8f79d4056fc9116ac9b11e0580e3598263334248 (diff) | |
download | Remap-bettererror.tar.gz Remap-bettererror.tar.bz2 Remap-bettererror.zip |
Add method to error message when failing to get method signaturebettererror
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/com/replaymod/gradle/remap/PsiUtils.kt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/kotlin/com/replaymod/gradle/remap/PsiUtils.kt b/src/main/kotlin/com/replaymod/gradle/remap/PsiUtils.kt index de42dcf..0240aa5 100644 --- a/src/main/kotlin/com/replaymod/gradle/remap/PsiUtils.kt +++ b/src/main/kotlin/com/replaymod/gradle/remap/PsiUtils.kt @@ -41,8 +41,12 @@ internal val PsiAnnotationMemberValue.resolvedLiteralValues: List<Pair<PsiLitera else -> listOfNotNull(resolvedLiteralValue) } +internal class MethodSignatureException(val method: PsiMethod, cause: Exception) + : Exception("Failed to resolve signature of method $method in ${method.containingFile}", cause) + internal object PsiUtils { - fun getSignature(method: PsiMethod): MethodSignature = MethodSignature(method.name, getDescriptor(method)) + fun getSignature(method: PsiMethod): MethodSignature = runCatching { MethodSignature(method.name, getDescriptor(method)) } + .getOrElse { throw MethodSignatureException(method, it as Exception) } private fun getDescriptor(method: PsiMethod): MethodDescriptor = MethodDescriptor( method.parameterList.parameters.map { getFieldType(it.type) }, |