FIR IDE: hoist up API to get Java getter/setter name of a property...
and expose API to get the getter and setter symbols for synthetic Java properties.
This commit is contained in:
committed by
Ilya Kirillov
parent
bb3f55dec2
commit
14b66872b5
@@ -131,3 +131,13 @@ fun FirAnnotationCall.getStringArgument(name: Name): String? =
|
||||
findArgumentByName(name)?.let { expression ->
|
||||
expression.safeAs<FirConstExpression<*>>()?.value as? String
|
||||
}
|
||||
|
||||
private val jvmNameAnnotationFqName = FqName.fromSegments(listOf("kotlin", "jvm", "JvmName"))
|
||||
|
||||
fun FirAnnotationContainer.getJvmNameFromAnnotation(target: AnnotationUseSiteTarget? = null): String? {
|
||||
val name = Name.identifier("name")
|
||||
val annotationCalls = getAnnotationsByFqName(jvmNameAnnotationFqName)
|
||||
return annotationCalls.firstNotNullOfOrNull { call ->
|
||||
call.getStringArgument(name)?.takeIf { target == null || call.useSiteTarget == target }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user