aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-07-31 21:20:49 +0200
committerLinnea Gräf <nea@nea.moe>2024-07-31 21:20:49 +0200
commit64f615806b4f21998cdc3da0885ad9958d4de369 (patch)
tree1859ca9c0c3adc89367e47bb18797fe07363d7b4 /src
parent8f79d4056fc9116ac9b11e0580e3598263334248 (diff)
downloadRemap-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')
-rw-r--r--src/main/kotlin/com/replaymod/gradle/remap/PsiUtils.kt6
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) },