[AA] KT-56617 Optimize type parameter access for Java class symbols

- Completion accesses symbol type parameters to render their names.
  Instead of building the whole list of type parameters, and
  consequently the whole FIR class, completion can now access the type
  parameter names directly.
This commit is contained in:
Marco Pennekamp
2023-03-01 16:54:17 +01:00
committed by Space Team
parent 77e374db77
commit d5933f28ab
2 changed files with 20 additions and 2 deletions
@@ -5,9 +5,9 @@
package org.jetbrains.kotlin.analysis.api.symbols.markers
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtTypeParameterSymbol
import org.jetbrains.kotlin.analysis.api.types.KtType
import org.jetbrains.kotlin.name.Name
public interface KtPossiblyNamedSymbol : KtSymbol {
@@ -20,4 +20,11 @@ public interface KtNamedSymbol : KtPossiblyNamedSymbol {
public interface KtSymbolWithTypeParameters : KtSymbol {
public val typeParameters: List<KtTypeParameterSymbol>
/**
* The names of [typeParameters]. Using this property should be preferred if only the names of type parameters are needed, because some
* symbol implementations may avoid building the full list of type parameters.
*/
public val typeParameterNames: List<Name>
get() = withValidityAssertion { typeParameters.map { it.name } }
}