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 jet.runtime.typeinfo.KotlinSignature;
020 import org.jetbrains.annotations.NotNull;
021 import org.jetbrains.annotations.Nullable;
022 import org.jetbrains.kotlin.types.JetType;
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 @KotlinSignature("fun getTypeParameters(): List<TypeParameterDescriptor>")
036 @NotNull
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 JetType getReturnType();
044
045 @NotNull
046 @Override
047 CallableDescriptor getOriginal();
048
049 @Override
050 CallableDescriptor substitute(@NotNull TypeSubstitutor substitutor);
051
052 @KotlinSignature("fun getValueParameters(): List<ValueParameterDescriptor>")
053 @NotNull
054 List<ValueParameterDescriptor> getValueParameters();
055
056 /**
057 * Kotlin functions always have stable parameter names that can be reliably used when calling them with named arguments.
058 * Functions loaded from platform definitions (e.g. Java binaries or JS) may have unstable parameter names that vary from
059 * one platform installation to another. These names can not be used reliably for calls with named arguments.
060 */
061 boolean hasStableParameterNames();
062
063 /**
064 * Sometimes parameter names are not available at all (e.g. Java binaries with not enough debug information).
065 * In this case, getName() returns synthetic names such as "p0", "p1" etc.
066 */
067 boolean hasSynthesizedParameterNames();
068
069 @NotNull
070 Collection<? extends CallableDescriptor> getOverriddenDescriptors();
071 }