diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt index 44efec6..7d4c054 100644 --- a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt +++ b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt @@ -113,8 +113,16 @@ internal class PsiMapper(private val map: MappingSet, private val file: PsiFile) val getter = property.getMethod.findPsi() as? PsiMethod ?: return val mappedGetter = findMapping(getter) ?: return if (mappedGetter != getter.name) { - val mapped = propertyNameByGetMethodName(Name.identifier(mappedGetter))!!.identifier - replaceIdentifier(expr, mapped) + val maybeMapped = propertyNameByGetMethodName(Name.identifier(mappedGetter)) + if (maybeMapped == null) { + // Can happen if a method is a synthetic property in the current mapping (e.g. `isNonBoss`) but not + // in the target mapping (e.g. `canUsePortal()`) + // TODO probably also want to convert in the opposite direction, though that's a lot harder + replaceIdentifier(expr, "$mappedGetter()") + } else { + val mapped = maybeMapped.identifier + replaceIdentifier(expr, mapped) + } } } |