[SLC/ULC] KTIJ-25335 Avoid generating fields with special names

- Due to the fixes for KTIJ-23584, when calling the UAST conversion
  `convertDeclarationOrElement` from `BaseKotlinConverter` (intellij
  project) for an SLC/ULC property, `convertDeclaration` failed because
  the declaration is "special". This caused `convertPsiElement` to be
  tried instead, which also returned `null`, causing the "failed to
  convert element" exception described in KTIJ-25335.
- In parallel to the solution for KTIJ-23584, which fixed the special
  names issue for functions, this commit skips UAST field generation for
  properties with special names.

^KTIJ-25335 fixed
^KTIJ-24121 fixed
This commit is contained in:
Marco Pennekamp
2023-06-01 14:16:21 +02:00
committed by Space Team
parent a036e41809
commit c00eb050ce
2 changed files with 8 additions and 10 deletions
@@ -35,18 +35,17 @@ import org.jetbrains.kotlin.config.JvmDefaultMode
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
import org.jetbrains.kotlin.lexer.KtTokens.*
import org.jetbrains.kotlin.light.classes.symbol.*
import org.jetbrains.kotlin.light.classes.symbol.annotations.*
import org.jetbrains.kotlin.light.classes.symbol.annotations.hasJvmOverloadsAnnotation
import org.jetbrains.kotlin.light.classes.symbol.annotations.hasJvmStaticAnnotation
import org.jetbrains.kotlin.light.classes.symbol.annotations.isHiddenOrSynthetic
import org.jetbrains.kotlin.light.classes.symbol.annotations.toOptionalFilter
import org.jetbrains.kotlin.light.classes.symbol.copy
import org.jetbrains.kotlin.light.classes.symbol.fields.SymbolLightField
import org.jetbrains.kotlin.light.classes.symbol.fields.SymbolLightFieldForEnumEntry
import org.jetbrains.kotlin.light.classes.symbol.fields.SymbolLightFieldForProperty
import org.jetbrains.kotlin.light.classes.symbol.isJvmField
import org.jetbrains.kotlin.light.classes.symbol.mapType
import org.jetbrains.kotlin.light.classes.symbol.methods.SymbolLightAccessorMethod
import org.jetbrains.kotlin.light.classes.symbol.methods.SymbolLightAnnotationsMethod
import org.jetbrains.kotlin.light.classes.symbol.methods.SymbolLightConstructor
import org.jetbrains.kotlin.light.classes.symbol.methods.SymbolLightNoArgConstructor
import org.jetbrains.kotlin.light.classes.symbol.methods.SymbolLightSimpleMethod
import org.jetbrains.kotlin.light.classes.symbol.methods.*
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.kotlin.name.StandardClassIds
import org.jetbrains.kotlin.psi.*
@@ -391,6 +390,7 @@ internal fun SymbolLightClassBase.createField(
isStatic: Boolean,
result: MutableList<KtLightField>
) {
if (declaration.name.isSpecial) return
if (!hasBackingField(declaration)) return
val isDelegated = (declaration as? KtKotlinPropertySymbol)?.isDelegatedProperty == true