aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/replaymod
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/com/replaymod')
-rw-r--r--src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
index 6a7424b..6065cbe 100644
--- a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
+++ b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
@@ -208,16 +208,22 @@ internal class PsiMapper(private val map: MappingSet, private val file: PsiFile)
}
}
- // Note: Supports only Mixins with a single target (ignores others) and only ones specified via class literals
- private fun getMixinTarget(annotation: PsiAnnotation): PsiClass? {
+ // Note: Supports only Mixins with a single target (ignores others)
+ private fun getMixinTarget(annotation: PsiAnnotation): String? {
for (pair in annotation.parameterList.attributes) {
val name = pair.name
- if (name != null && "value" != name) continue
- val value = pair.value
- if (value !is PsiClassObjectAccessExpression) continue
- val type = value.operand
- val reference = type.innermostComponentReferenceElement ?: continue
- return reference.resolve() as PsiClass?
+ if (name == null || "value" == name) {
+ val value = pair.value
+ if (value !is PsiClassObjectAccessExpression) continue
+ val type = value.operand
+ val reference = type.innermostComponentReferenceElement ?: continue
+ return (reference.resolve() as PsiClass?)?.dollarQualifiedName
+ }
+ if ("targets" == name) {
+ val value = pair.value
+ if (value !is PsiLiteral) continue
+ return value.value as? String ?: continue
+ }
}
return null
}
@@ -396,8 +402,7 @@ internal class PsiMapper(private val map: MappingSet, private val file: PsiFile)
remapAtTargets()
- val target = getMixinTarget(annotation) ?: return
- val qualifiedName = target.dollarQualifiedName ?: return
+ val qualifiedName = getMixinTarget(annotation) ?: return
val mapping = map.findClassMapping(qualifiedName) ?: return