aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
index 0e5395a..ca11e96 100644
--- a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
+++ b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
@@ -215,6 +215,9 @@ internal class PsiMapper(private val map: MappingSet, private val file: PsiFile)
})
}
+ private fun remapInternalType(internalType: String): String =
+ StringBuilder().apply { remapInternalType(internalType, this) }.toString()
+
private fun remapInternalType(internalType: String, result: StringBuilder): ClassMapping<*, *>? {
if (internalType[0] == 'L') {
val type = internalType.substring(1, internalType.length - 1).replace('/', '.')
@@ -228,6 +231,18 @@ internal class PsiMapper(private val map: MappingSet, private val file: PsiFile)
return null
}
+ private fun remapMixinTarget(target: String): String {
+ return if (target.contains(':') || target.contains('(')) {
+ remapFullyQualifiedMethodOrField(target)
+ } else {
+ if (target[0] == 'L') {
+ remapInternalType(target)
+ } else {
+ remapInternalType("L$target;").drop(1).dropLast(1)
+ }
+ }
+ }
+
private fun remapFullyQualifiedMethodOrField(signature: String): String {
val ownerEnd = signature.indexOf(';')
var argsBegin = signature.indexOf('(')
@@ -288,7 +303,7 @@ internal class PsiMapper(private val map: MappingSet, private val file: PsiFile)
for (attribute in annotation.parameterList.attributes) {
if ("target" != attribute.name) continue
val signature = attribute.literalValue ?: continue
- val newSignature = remapFullyQualifiedMethodOrField(signature)
+ val newSignature = remapMixinTarget(signature)
if (newSignature != signature) {
val value = attribute.value!!
replace(value, "\"$newSignature\"")