001    /*
002     * Copyright 2010-2015 JetBrains s.r.o.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.jetbrains.kotlin.descriptors;
018    
019    import org.jetbrains.annotations.NotNull;
020    import org.jetbrains.annotations.Nullable;
021    import org.jetbrains.annotations.ReadOnly;
022    import org.jetbrains.kotlin.types.KotlinType;
023    import org.jetbrains.kotlin.types.TypeSubstitutor;
024    
025    import java.util.Collection;
026    import java.util.List;
027    
028    public interface CallableDescriptor extends DeclarationDescriptorWithVisibility, DeclarationDescriptorNonRoot {
029        @Nullable
030        ReceiverParameterDescriptor getExtensionReceiverParameter();
031    
032        @Nullable
033        ReceiverParameterDescriptor getDispatchReceiverParameter();
034    
035        @NotNull
036        @ReadOnly
037        List<TypeParameterDescriptor> getTypeParameters();
038    
039        /**
040         * Method may return null for not yet fully initialized object or if error occurred.
041         */
042        @Nullable
043        KotlinType getReturnType();
044    
045        @NotNull
046        @Override
047        CallableDescriptor getOriginal();
048    
049        @Override
050        CallableDescriptor substitute(@NotNull TypeSubstitutor substitutor);
051    
052        @NotNull
053        List<ValueParameterDescriptor> getValueParameters();
054    
055        /**
056         * Kotlin functions always have stable parameter names that can be reliably used when calling them with named arguments.
057         * Functions loaded from platform definitions (e.g. Java binaries or JS) may have unstable parameter names that vary from
058         * one platform installation to another. These names can not be used reliably for calls with named arguments.
059         */
060        boolean hasStableParameterNames();
061    
062        /**
063         * Sometimes parameter names are not available at all (e.g. Java binaries with not enough debug information).
064         * In this case, getName() returns synthetic names such as "p0", "p1" etc.
065         */
066        boolean hasSynthesizedParameterNames();
067    
068        @NotNull
069        Collection<? extends CallableDescriptor> getOverriddenDescriptors();
070    }