[SLC] avoid constructor parameters capturing

^KT-56046
This commit is contained in:
Dmitrii Gridin
2023-01-26 20:58:29 +01:00
committed by Space Team
parent 80a80d1188
commit 57b6db4f0f
4 changed files with 11 additions and 7 deletions
@@ -69,7 +69,7 @@ class SymbolLightClassForFacade(
} else { } else {
LazyAnnotationsBox( LazyAnnotationsBox(
annotationsProvider = SymbolAnnotationsProvider( annotationsProvider = SymbolAnnotationsProvider(
ktModule = ktModule, ktModule = this.ktModule,
annotatedSymbolPointer = firstFileInFacade.symbolPointerOfType<KtFileSymbol>(), annotatedSymbolPointer = firstFileInFacade.symbolPointerOfType<KtFileSymbol>(),
annotationUseSiteTarget = AnnotationUseSiteTarget.FILE, annotationUseSiteTarget = AnnotationUseSiteTarget.FILE,
acceptAnnotationsWithoutSite = true, acceptAnnotationsWithoutSite = true,
@@ -93,10 +93,10 @@ internal class SymbolLightAccessorMethod private constructor(
propertyAccessorSymbol().getJvmNameFromAnnotation(accessorSite) ?: run { propertyAccessorSymbol().getJvmNameFromAnnotation(accessorSite) ?: run {
val symbol = propertySymbol() val symbol = propertySymbol()
val defaultName = symbol.name.identifier.let { val defaultName = symbol.name.identifier.let {
if (containingClass.isAnnotationType) it else it.abiName() if (this@SymbolLightAccessorMethod.containingClass.isAnnotationType) it else it.abiName()
} }
symbol.computeJvmMethodName(defaultName, containingClass, accessorSite) symbol.computeJvmMethodName(defaultName, this@SymbolLightAccessorMethod.containingClass, accessorSite)
} }
} }
} }
@@ -196,7 +196,7 @@ internal class SymbolLightAccessorMethod private constructor(
), ),
additionalAnnotationsProvider = NullabilityAnnotationsProvider { additionalAnnotationsProvider = NullabilityAnnotationsProvider {
val nullabilityApplicable = isGetter && val nullabilityApplicable = isGetter &&
!(isParameter && containingClass.isAnnotationType) && !(isParameter && this.containingClass.isAnnotationType) &&
!modifierList.hasModifierProperty(PsiModifier.PRIVATE) !modifierList.hasModifierProperty(PsiModifier.PRIVATE)
if (nullabilityApplicable) { if (nullabilityApplicable) {
@@ -44,7 +44,7 @@ internal class SymbolLightConstructor(
override fun getTypeParameters(): Array<PsiTypeParameter> = PsiTypeParameter.EMPTY_ARRAY override fun getTypeParameters(): Array<PsiTypeParameter> = PsiTypeParameter.EMPTY_ARRAY
private val _modifierList: PsiModifierList by lazyPub { private val _modifierList: PsiModifierList by lazyPub {
val initialValue = if (containingClass is SymbolLightClassForEnumEntry) { val initialValue = if (this.containingClass is SymbolLightClassForEnumEntry) {
LazyModifiersBox.VISIBILITY_MODIFIERS_MAP.with(PsiModifier.PACKAGE_LOCAL) LazyModifiersBox.VISIBILITY_MODIFIERS_MAP.with(PsiModifier.PACKAGE_LOCAL)
} else { } else {
emptyMap() emptyMap()
@@ -47,7 +47,11 @@ internal class SymbolLightSimpleMethod(
) { ) {
private val _name: String by lazyPub { private val _name: String by lazyPub {
withFunctionSymbol { functionSymbol -> withFunctionSymbol { functionSymbol ->
functionSymbol.computeJvmMethodName(functionSymbol.name.asString(), containingClass, annotationUseSiteTarget = null) functionSymbol.computeJvmMethodName(
functionSymbol.name.asString(),
this@SymbolLightSimpleMethod.containingClass,
annotationUseSiteTarget = null,
)
} }
} }
@@ -188,7 +192,7 @@ internal class SymbolLightSimpleMethod(
this@SymbolLightSimpleMethod, this@SymbolLightSimpleMethod,
allowErrorTypes = true, allowErrorTypes = true,
KtTypeMappingMode.RETURN_TYPE, KtTypeMappingMode.RETURN_TYPE,
containingClass.isAnnotationType, this@SymbolLightSimpleMethod.containingClass.isAnnotationType,
) )
} ?: nonExistentType() } ?: nonExistentType()
} }