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.kotlin.types.KotlinType; 022 import org.jetbrains.kotlin.types.TypeSubstitutor; 023 024 import java.util.Collection; 025 import java.util.List; 026 027 public interface CallableDescriptor extends DeclarationDescriptorWithVisibility, DeclarationDescriptorNonRoot { 028 @Nullable 029 ReceiverParameterDescriptor getExtensionReceiverParameter(); 030 031 @Nullable 032 ReceiverParameterDescriptor getDispatchReceiverParameter(); 033 034 @NotNull 035 List<TypeParameterDescriptor> getTypeParameters(); 036 037 /** 038 * Method may return null for not yet fully initialized object or if error occurred. 039 */ 040 @Nullable 041 KotlinType getReturnType(); 042 043 @NotNull 044 @Override 045 CallableDescriptor getOriginal(); 046 047 @Override 048 CallableDescriptor substitute(@NotNull TypeSubstitutor substitutor); 049 050 @NotNull 051 List<ValueParameterDescriptor> getValueParameters(); 052 053 /** 054 * Kotlin functions always have stable parameter names that can be reliably used when calling them with named arguments. 055 * Functions loaded from platform definitions (e.g. Java binaries or JS) may have unstable parameter names that vary from 056 * one platform installation to another. These names can not be used reliably for calls with named arguments. 057 */ 058 boolean hasStableParameterNames(); 059 060 /** 061 * Sometimes parameter names are not available at all (e.g. Java binaries with not enough debug information). 062 * In this case, getName() returns synthetic names such as "p0", "p1" etc. 063 */ 064 boolean hasSynthesizedParameterNames(); 065 066 @NotNull 067 Collection<? extends CallableDescriptor> getOverriddenDescriptors(); 068 }