org.jetbrains.kotlin.descriptors.impl
Class FunctionDescriptorImpl
java.lang.Object
org.jetbrains.kotlin.descriptors.annotations.AnnotatedImpl
org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorImpl
org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorNonRootImpl
org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl
- All Implemented Interfaces:
- CallableDescriptor, CallableMemberDescriptor, DeclarationDescriptor, DeclarationDescriptorNonRoot, DeclarationDescriptorWithSource, DeclarationDescriptorWithVisibility, FunctionDescriptor, MemberDescriptor, Named
- Direct Known Subclasses:
- ClassConstructorDescriptorImpl, SimpleFunctionDescriptorImpl
public abstract class FunctionDescriptorImpl
- extends DeclarationDescriptorNonRootImpl
- implements FunctionDescriptor
|
Method Summary |
|
accept(DeclarationDescriptorVisitor<R,D> visitor,
D data)
|
FunctionDescriptor |
copy(DeclarationDescriptor newOwner,
Modality modality,
Visibility visibility,
CallableMemberDescriptor.Kind kind,
boolean copyOverrides)
|
protected abstract FunctionDescriptorImpl |
createSubstitutedCopy(DeclarationDescriptor newOwner,
FunctionDescriptor original,
CallableMemberDescriptor.Kind kind,
Name newName,
Annotations annotations,
SourceElement source)
|
protected FunctionDescriptor |
doSubstitute(FunctionDescriptorImpl.CopyConfiguration configuration)
|
ReceiverParameterDescriptor |
getDispatchReceiverParameter()
|
ReceiverParameterDescriptor |
getExtensionReceiverParameter()
|
protected KotlinType |
getExtensionReceiverParameterType()
|
FunctionDescriptor |
getInitialSignatureDescriptor()
|
CallableMemberDescriptor.Kind |
getKind()
Is this a real function or function projection. |
Modality |
getModality()
|
FunctionDescriptor |
getOriginal()
|
java.util.Collection<? extends FunctionDescriptor> |
getOverriddenDescriptors()
This method should be used with q Wgreat care, because if descriptor is substituted one, calling 'getOverriddenDescriptors'
may force lazy computation, that's unnecessary in most cases. |
KotlinType |
getReturnType()
Method may return null for not yet fully initialized object or if error occurred. |
static java.util.List<ValueParameterDescriptor> |
getSubstitutedValueParameters(FunctionDescriptor substitutedDescriptor,
java.util.List<ValueParameterDescriptor> unsubstitutedValueParameters,
TypeSubstitutor substitutor,
boolean dropOriginal,
boolean preserveSourceElement)
|
java.util.List<TypeParameterDescriptor> |
getTypeParameters()
|
|
getUserData(FunctionDescriptor.UserDataKey<V> key)
|
java.util.List<ValueParameterDescriptor> |
getValueParameters()
|
Visibility |
getVisibility()
|
boolean |
hasStableParameterNames()
Kotlin functions always have stable parameter names that can be reliably used when calling them with named arguments. |
boolean |
hasSynthesizedParameterNames()
Sometimes parameter names are not available at all (e.g. |
FunctionDescriptorImpl |
initialize(KotlinType receiverParameterType,
ReceiverParameterDescriptor dispatchReceiverParameter,
java.util.List<? extends TypeParameterDescriptor> typeParameters,
java.util.List<ValueParameterDescriptor> unsubstitutedValueParameters,
KotlinType unsubstitutedReturnType,
Modality modality,
Visibility visibility)
|
boolean |
isExternal()
|
boolean |
isHeader()
|
boolean |
isHiddenForResolutionEverywhereBesideSupercalls()
|
boolean |
isHiddenToOvercomeSignatureClash()
|
boolean |
isImpl()
|
boolean |
isInfix()
|
boolean |
isInline()
|
boolean |
isOperator()
|
boolean |
isSuspend()
|
boolean |
isTailrec()
|
FunctionDescriptor.CopyBuilder<? extends FunctionDescriptor> |
newCopyBuilder()
|
protected FunctionDescriptorImpl.CopyConfiguration |
newCopyBuilder(TypeSubstitutor substitutor)
|
void |
setExternal(boolean isExternal)
|
void |
setHasStableParameterNames(boolean hasStableParameterNames)
|
void |
setHasSynthesizedParameterNames(boolean hasSynthesizedParameterNames)
|
void |
setHeader(boolean isHeader)
|
void |
setHiddenToOvercomeSignatureClash(boolean hiddenToOvercomeSignatureClash)
|
void |
setImpl(boolean isImpl)
|
void |
setInfix(boolean isInfix)
|
void |
setInline(boolean isInline)
|
void |
setOperator(boolean isOperator)
|
void |
setOverriddenDescriptors(java.util.Collection<? extends CallableMemberDescriptor> overriddenDescriptors)
|
void |
setReturnType(KotlinType unsubstitutedReturnType)
|
void |
setSuspend(boolean suspend)
|
void |
setTailrec(boolean isTailrec)
|
void |
setVisibility(Visibility visibility)
|
FunctionDescriptor |
substitute(TypeSubstitutor originalSubstitutor)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jetbrains.kotlin.descriptors.Named |
getName |
userDataMap
protected java.util.Map<FunctionDescriptor.UserDataKey<?>,java.lang.Object> userDataMap
FunctionDescriptorImpl
protected FunctionDescriptorImpl(@NotNull
DeclarationDescriptor containingDeclaration,
@Nullable
FunctionDescriptor original,
@NotNull
Annotations annotations,
@NotNull
Name name,
@NotNull
CallableMemberDescriptor.Kind kind,
@NotNull
SourceElement source)
initialize
@NotNull
public FunctionDescriptorImpl initialize(@Nullable
KotlinType receiverParameterType,
@Nullable
ReceiverParameterDescriptor dispatchReceiverParameter,
@NotNull
java.util.List<? extends TypeParameterDescriptor> typeParameters,
@NotNull
java.util.List<ValueParameterDescriptor> unsubstitutedValueParameters,
@Nullable
KotlinType unsubstitutedReturnType,
@Nullable
Modality modality,
@NotNull
Visibility visibility)
setVisibility
public void setVisibility(@NotNull
Visibility visibility)
setOperator
public void setOperator(boolean isOperator)
setInfix
public void setInfix(boolean isInfix)
setExternal
public void setExternal(boolean isExternal)
setInline
public void setInline(boolean isInline)
setTailrec
public void setTailrec(boolean isTailrec)
setHeader
public void setHeader(boolean isHeader)
setImpl
public void setImpl(boolean isImpl)
setHiddenToOvercomeSignatureClash
public void setHiddenToOvercomeSignatureClash(boolean hiddenToOvercomeSignatureClash)
setSuspend
public void setSuspend(boolean suspend)
setReturnType
public void setReturnType(@NotNull
KotlinType unsubstitutedReturnType)
setHasStableParameterNames
public void setHasStableParameterNames(boolean hasStableParameterNames)
setHasSynthesizedParameterNames
public void setHasSynthesizedParameterNames(boolean hasSynthesizedParameterNames)
getExtensionReceiverParameter
@Nullable
public ReceiverParameterDescriptor getExtensionReceiverParameter()
- Specified by:
getExtensionReceiverParameter in interface CallableDescriptor
getDispatchReceiverParameter
@Nullable
public ReceiverParameterDescriptor getDispatchReceiverParameter()
- Specified by:
getDispatchReceiverParameter in interface CallableDescriptor
getOverriddenDescriptors
@NotNull
public java.util.Collection<? extends FunctionDescriptor> getOverriddenDescriptors()
- Description copied from interface:
FunctionDescriptor
- This method should be used with q Wgreat care, because if descriptor is substituted one, calling 'getOverriddenDescriptors'
may force lazy computation, that's unnecessary in most cases.
So, if 'getOriginal().getOverriddenDescriptors()' is enough for you, please use it instead.
- Specified by:
getOverriddenDescriptors in interface CallableDescriptor- Specified by:
getOverriddenDescriptors in interface CallableMemberDescriptor- Specified by:
getOverriddenDescriptors in interface FunctionDescriptor
getModality
@NotNull
public Modality getModality()
- Specified by:
getModality in interface MemberDescriptor
getVisibility
@NotNull
public Visibility getVisibility()
- Specified by:
getVisibility in interface DeclarationDescriptorWithVisibility- Specified by:
getVisibility in interface MemberDescriptor
isOperator
public boolean isOperator()
- Specified by:
isOperator in interface FunctionDescriptor
isInfix
public boolean isInfix()
- Specified by:
isInfix in interface FunctionDescriptor
isExternal
public boolean isExternal()
- Specified by:
isExternal in interface MemberDescriptor
isInline
public boolean isInline()
- Specified by:
isInline in interface FunctionDescriptor
isTailrec
public boolean isTailrec()
- Specified by:
isTailrec in interface FunctionDescriptor
isSuspend
public boolean isSuspend()
- Specified by:
isSuspend in interface FunctionDescriptor
isHeader
public boolean isHeader()
- Specified by:
isHeader in interface MemberDescriptor
isImpl
public boolean isImpl()
- Specified by:
isImpl in interface MemberDescriptor
getUserData
public <V> V getUserData(FunctionDescriptor.UserDataKey<V> key)
- Specified by:
getUserData in interface FunctionDescriptor
isHiddenToOvercomeSignatureClash
public boolean isHiddenToOvercomeSignatureClash()
- Specified by:
isHiddenToOvercomeSignatureClash in interface FunctionDescriptor
- Returns:
- true if descriptor signature clashed with some other signature and it's supposed to be legal
See java.nio.CharBuffer
setOverriddenDescriptors
public void setOverriddenDescriptors(@NotNull
java.util.Collection<? extends CallableMemberDescriptor> overriddenDescriptors)
- Specified by:
setOverriddenDescriptors in interface CallableMemberDescriptor
getTypeParameters
@NotNull
public java.util.List<TypeParameterDescriptor> getTypeParameters()
- Specified by:
getTypeParameters in interface CallableDescriptor
getValueParameters
@NotNull
public java.util.List<ValueParameterDescriptor> getValueParameters()
- Specified by:
getValueParameters in interface CallableDescriptor
hasStableParameterNames
public boolean hasStableParameterNames()
- Description copied from interface:
CallableDescriptor
- Kotlin functions always have stable parameter names that can be reliably used when calling them with named arguments.
Functions loaded from platform definitions (e.g. Java binaries or JS) may have unstable parameter names that vary from
one platform installation to another. These names can not be used reliably for calls with named arguments.
- Specified by:
hasStableParameterNames in interface CallableDescriptor
hasSynthesizedParameterNames
public boolean hasSynthesizedParameterNames()
- Description copied from interface:
CallableDescriptor
- Sometimes parameter names are not available at all (e.g. Java binaries with not enough debug information).
In this case, getName() returns synthetic names such as "p0", "p1" etc.
- Specified by:
hasSynthesizedParameterNames in interface CallableDescriptor
getReturnType
public KotlinType getReturnType()
- Description copied from interface:
CallableDescriptor
- Method may return null for not yet fully initialized object or if error occurred.
- Specified by:
getReturnType in interface CallableDescriptor
getOriginal
@NotNull
public FunctionDescriptor getOriginal()
- Specified by:
getOriginal in interface CallableDescriptor- Specified by:
getOriginal in interface CallableMemberDescriptor- Specified by:
getOriginal in interface DeclarationDescriptor- Specified by:
getOriginal in interface DeclarationDescriptorWithSource- Specified by:
getOriginal in interface FunctionDescriptor- Overrides:
getOriginal in class DeclarationDescriptorNonRootImpl
- Returns:
- The descriptor that corresponds to the original declaration of this element.
A descriptor can be obtained from its original by substituting type arguments (of the declaring class
or of the element itself).
returns
this object if the current descriptor is original itself
getKind
@NotNull
public CallableMemberDescriptor.Kind getKind()
- Description copied from interface:
CallableMemberDescriptor
- Is this a real function or function projection.
- Specified by:
getKind in interface CallableMemberDescriptor
substitute
public FunctionDescriptor substitute(@NotNull
TypeSubstitutor originalSubstitutor)
- Specified by:
substitute in interface CallableDescriptor- Specified by:
substitute in interface DeclarationDescriptor- Specified by:
substitute in interface FunctionDescriptor
getExtensionReceiverParameterType
@Nullable
protected KotlinType getExtensionReceiverParameterType()
isHiddenForResolutionEverywhereBesideSupercalls
public boolean isHiddenForResolutionEverywhereBesideSupercalls()
- Specified by:
isHiddenForResolutionEverywhereBesideSupercalls in interface FunctionDescriptor
newCopyBuilder
@NotNull
public FunctionDescriptor.CopyBuilder<? extends FunctionDescriptor> newCopyBuilder()
- Specified by:
newCopyBuilder in interface FunctionDescriptor
newCopyBuilder
@NotNull
protected FunctionDescriptorImpl.CopyConfiguration newCopyBuilder(@NotNull
TypeSubstitutor substitutor)
doSubstitute
@Nullable
protected FunctionDescriptor doSubstitute(@NotNull
FunctionDescriptorImpl.CopyConfiguration configuration)
copy
@NotNull
public FunctionDescriptor copy(DeclarationDescriptor newOwner,
Modality modality,
Visibility visibility,
CallableMemberDescriptor.Kind kind,
boolean copyOverrides)
- Specified by:
copy in interface CallableMemberDescriptor- Specified by:
copy in interface FunctionDescriptor
createSubstitutedCopy
@NotNull
protected abstract FunctionDescriptorImpl createSubstitutedCopy(@NotNull
DeclarationDescriptor newOwner,
@Nullable
FunctionDescriptor original,
@NotNull
CallableMemberDescriptor.Kind kind,
@Nullable
Name newName,
@NotNull
Annotations annotations,
@NotNull
SourceElement source)
accept
public <R,D> R accept(DeclarationDescriptorVisitor<R,D> visitor,
D data)
- Specified by:
accept in interface DeclarationDescriptor
getSubstitutedValueParameters
@Nullable
public static java.util.List<ValueParameterDescriptor> getSubstitutedValueParameters(FunctionDescriptor substitutedDescriptor,
@NotNull
java.util.List<ValueParameterDescriptor> unsubstitutedValueParameters,
@NotNull
TypeSubstitutor substitutor,
boolean dropOriginal,
boolean preserveSourceElement)
getInitialSignatureDescriptor
@Nullable
public FunctionDescriptor getInitialSignatureDescriptor()
- Specified by:
getInitialSignatureDescriptor in interface FunctionDescriptor
- Returns:
- descriptor that represents initial signature, e.g in case of result SimpleFunctionDescriptor.createRenamedCopy it returns
descriptor before rename