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