FIR2IR: set proper visibility of backing fields with @JvmField
This commit is contained in:
committed by
Mikhail Glukhikh
parent
f3475fd098
commit
13ef97e51e
@@ -590,6 +590,7 @@ class Fir2IrDeclarationStorage(
|
|||||||
get() = when {
|
get() = when {
|
||||||
isLateInit -> setter?.visibility ?: status.visibility
|
isLateInit -> setter?.visibility ?: status.visibility
|
||||||
isConst -> status.visibility
|
isConst -> status.visibility
|
||||||
|
hasJvmFieldAnnotation -> status.visibility
|
||||||
else -> Visibilities.PRIVATE
|
else -> Visibilities.PRIVATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ fun FirTypeParameterBuilder.addDefaultBoundIfNecessary(isFlexible: Boolean = fal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline val FirDeclaration.isFromLibrary: Boolean
|
|
||||||
get() = origin == FirDeclarationOrigin.Library
|
|
||||||
inline val FirRegularClass.isInner get() = status.isInner
|
inline val FirRegularClass.isInner get() = status.isInner
|
||||||
inline val FirRegularClass.isCompanion get() = status.isCompanion
|
inline val FirRegularClass.isCompanion get() = status.isCompanion
|
||||||
inline val FirRegularClass.isData get() = status.isData
|
inline val FirRegularClass.isData get() = status.isData
|
||||||
@@ -114,12 +112,20 @@ fun FirRegularClass.addDeclaration(declaration: FirDeclaration) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private object IsFromVarargKey: FirDeclarationDataKey()
|
private object IsFromVarargKey : FirDeclarationDataKey()
|
||||||
var FirProperty.isFromVararg: Boolean? by FirDeclarationDataRegistry.data(IsFromVarargKey)
|
var FirProperty.isFromVararg: Boolean? by FirDeclarationDataRegistry.data(IsFromVarargKey)
|
||||||
|
|
||||||
|
inline val FirProperty.hasJvmFieldAnnotation: Boolean
|
||||||
|
get() = annotations.any {
|
||||||
|
val classId = it.annotationTypeRef.coneTypeSafe<ConeClassLikeType>()?.classId
|
||||||
|
classId?.packageFqName?.asString() == "kotlin.jvm" && classId.relativeClassName.asString() == "JvmField"
|
||||||
|
}
|
||||||
|
|
||||||
fun FirAnnotatedDeclaration.hasAnnotation(classId: ClassId): Boolean {
|
fun FirAnnotatedDeclaration.hasAnnotation(classId: ClassId): Boolean {
|
||||||
return annotations.any { it.annotationTypeRef.coneTypeSafe<ConeClassLikeType>()?.classId == classId }
|
return annotations.any { it.annotationTypeRef.coneTypeSafe<ConeClassLikeType>()?.classId == classId }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline val FirDeclaration.isFromLibrary: Boolean
|
||||||
|
get() = origin == FirDeclarationOrigin.Library
|
||||||
inline val FirDeclaration.isSynthetic: Boolean
|
inline val FirDeclaration.isSynthetic: Boolean
|
||||||
get() = origin == FirDeclarationOrigin.Synthetic
|
get() = origin == FirDeclarationOrigin.Synthetic
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +InlineClasses
|
// !LANGUAGE: +InlineClasses
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +JvmFieldInInterface
|
// !LANGUAGE: +JvmFieldInInterface
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user