org.jetbrains.kotlin.descriptors.impl
Class FunctionDescriptorImpl

java.lang.Object
  extended by org.jetbrains.kotlin.descriptors.annotations.AnnotatedImpl
      extended by org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorImpl
          extended by org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorNonRootImpl
              extended by org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl
All Implemented Interfaces:
Annotated, CallableDescriptor, CallableMemberDescriptor, DeclarationDescriptor, DeclarationDescriptorNonRoot, DeclarationDescriptorWithSource, DeclarationDescriptorWithVisibility, FunctionDescriptor, MemberDescriptor, Named
Direct Known Subclasses:
ConstructorDescriptorImpl, ScriptCodeDescriptor, SimpleFunctionDescriptorImpl

public abstract class FunctionDescriptorImpl
extends DeclarationDescriptorNonRootImpl
implements FunctionDescriptor


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
CallableMemberDescriptor.Kind
 
Constructor Summary
protected FunctionDescriptorImpl(DeclarationDescriptor containingDeclaration, FunctionDescriptor original, Annotations annotations, Name name, CallableMemberDescriptor.Kind kind, SourceElement source)
           
 
Method Summary
<R,D> R
accept(DeclarationDescriptorVisitor<R,D> visitor, D data)
           
 void addOverriddenDescriptor(CallableMemberDescriptor overriddenFunction)
           
protected abstract  FunctionDescriptorImpl createSubstitutedCopy(DeclarationDescriptor newOwner, FunctionDescriptor original, CallableMemberDescriptor.Kind kind)
           
protected  FunctionDescriptor doSubstitute(TypeSubstitutor originalSubstitutor, DeclarationDescriptor newOwner, Modality newModality, Visibility newVisibility, FunctionDescriptor original, boolean copyOverrides, CallableMemberDescriptor.Kind kind)
           
protected  FunctionDescriptor doSubstitute(TypeSubstitutor originalSubstitutor, DeclarationDescriptor newOwner, Modality newModality, Visibility newVisibility, FunctionDescriptor original, boolean copyOverrides, CallableMemberDescriptor.Kind kind, java.util.List<ValueParameterDescriptor> newValueParameterDescriptors, JetType newExtensionReceiverParameterType, JetType newReturnType)
           
 ReceiverParameterDescriptor getDispatchReceiverParameter()
           
 ReceiverParameterDescriptor getExtensionReceiverParameter()
           
protected  JetType getExtensionReceiverParameterType()
           
 CallableMemberDescriptor.Kind getKind()
          Is this a real function or function projection.
 Modality getModality()
           
 FunctionDescriptor getOriginal()
           
 java.util.Collection<? extends FunctionDescriptor> getOverriddenDescriptors()
           
 JetType 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)
           
 java.util.List<TypeParameterDescriptor> getTypeParameters()
           
 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(JetType receiverParameterType, ReceiverParameterDescriptor dispatchReceiverParameter, java.util.List<? extends TypeParameterDescriptor> typeParameters, java.util.List<ValueParameterDescriptor> unsubstitutedValueParameters, JetType unsubstitutedReturnType, Modality modality, Visibility visibility)
           
 void setReturnType(JetType unsubstitutedReturnType)
           
 void setVisibility(Visibility visibility)
           
 FunctionDescriptor substitute(TypeSubstitutor originalSubstitutor)
           
 
Methods inherited from class org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorNonRootImpl
getContainingDeclaration, getSource
 
Methods inherited from class org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorImpl
acceptVoid, getName, toString, toString
 
Methods inherited from class org.jetbrains.kotlin.descriptors.annotations.AnnotatedImpl
getAnnotations
 
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.FunctionDescriptor
copy, getContainingDeclaration
 
Methods inherited from interface org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource
getSource
 
Methods inherited from interface org.jetbrains.kotlin.descriptors.DeclarationDescriptor
acceptVoid
 
Methods inherited from interface org.jetbrains.kotlin.descriptors.annotations.Annotated
getAnnotations
 
Methods inherited from interface org.jetbrains.kotlin.descriptors.Named
getName
 

Constructor Detail

FunctionDescriptorImpl

protected FunctionDescriptorImpl(@NotNull
                                 DeclarationDescriptor containingDeclaration,
                                 @Nullable
                                 FunctionDescriptor original,
                                 @NotNull
                                 Annotations annotations,
                                 @NotNull
                                 Name name,
                                 @NotNull
                                 CallableMemberDescriptor.Kind kind,
                                 @NotNull
                                 SourceElement source)
Method Detail

initialize

@NotNull
public FunctionDescriptorImpl initialize(@Nullable
                                                 JetType receiverParameterType,
                                                 @Nullable
                                                 ReceiverParameterDescriptor dispatchReceiverParameter,
                                                 @NotNull
                                                 java.util.List<? extends TypeParameterDescriptor> typeParameters,
                                                 @NotNull
                                                 java.util.List<ValueParameterDescriptor> unsubstitutedValueParameters,
                                                 @Nullable
                                                 JetType unsubstitutedReturnType,
                                                 @Nullable
                                                 Modality modality,
                                                 @NotNull
                                                 Visibility visibility)

setVisibility

public void setVisibility(@NotNull
                          Visibility visibility)

setReturnType

public void setReturnType(@NotNull
                          JetType unsubstitutedReturnType)

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()
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

addOverriddenDescriptor

public void addOverriddenDescriptor(@NotNull
                                    CallableMemberDescriptor overriddenFunction)
Specified by:
addOverriddenDescriptor 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 JetType 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 final FunctionDescriptor substitute(@NotNull
                                           TypeSubstitutor originalSubstitutor)
Specified by:
substitute in interface CallableDescriptor
Specified by:
substitute in interface DeclarationDescriptor
Specified by:
substitute in interface FunctionDescriptor

doSubstitute

@Nullable
protected FunctionDescriptor doSubstitute(@NotNull
                                                   TypeSubstitutor originalSubstitutor,
                                                   @NotNull
                                                   DeclarationDescriptor newOwner,
                                                   @NotNull
                                                   Modality newModality,
                                                   @NotNull
                                                   Visibility newVisibility,
                                                   @Nullable
                                                   FunctionDescriptor original,
                                                   boolean copyOverrides,
                                                   @NotNull
                                                   CallableMemberDescriptor.Kind kind)

getExtensionReceiverParameterType

@Nullable
protected JetType getExtensionReceiverParameterType()

doSubstitute

@Nullable
protected FunctionDescriptor doSubstitute(@NotNull
                                                   TypeSubstitutor originalSubstitutor,
                                                   @NotNull
                                                   DeclarationDescriptor newOwner,
                                                   @NotNull
                                                   Modality newModality,
                                                   @NotNull
                                                   Visibility newVisibility,
                                                   @Nullable
                                                   FunctionDescriptor original,
                                                   boolean copyOverrides,
                                                   @NotNull
                                                   CallableMemberDescriptor.Kind kind,
                                                   @NotNull
                                                   java.util.List<ValueParameterDescriptor> newValueParameterDescriptors,
                                                   @Nullable
                                                   JetType newExtensionReceiverParameterType,
                                                   @NotNull
                                                   JetType newReturnType)

createSubstitutedCopy

@NotNull
protected abstract FunctionDescriptorImpl createSubstitutedCopy(@NotNull
                                                                        DeclarationDescriptor newOwner,
                                                                        @Nullable
                                                                        FunctionDescriptor original,
                                                                        @NotNull
                                                                        CallableMemberDescriptor.Kind kind)

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)