From c2118df80e5f0f602ede84958c59fd00cc7f2b38 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Sat, 5 Jun 2021 10:19:21 +0200 Subject: Skip pattern if body (not the entire method) is unchanged We may still require some signature changes to make it compile, but these are generally not relevant for the pattern functionality itself. --- src/main/kotlin/com/replaymod/gradle/remap/PsiPatterns.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/replaymod/gradle/remap/PsiPatterns.kt b/src/main/kotlin/com/replaymod/gradle/remap/PsiPatterns.kt index 3c095c4..a1f6e8b 100644 --- a/src/main/kotlin/com/replaymod/gradle/remap/PsiPatterns.kt +++ b/src/main/kotlin/com/replaymod/gradle/remap/PsiPatterns.kt @@ -38,7 +38,8 @@ internal class PsiPatterns(private val annotationFQN: String) { } val replacementBody = replacementMethod.body!! - if (method.text == replacementMethod.text) return + // If the body does not change, then there is no point in applying this pattern + if (body.text == replacementBody.text) return // If either body is empty, then consider the pattern to be disabled if (body.statements.isEmpty()) return -- cgit