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.name.Name;
022 import org.jetbrains.kotlin.types.JetType;
023
024 import java.util.Set;
025
026 public interface ValueParameterDescriptor extends VariableDescriptor, ParameterDescriptor {
027 /**
028 * Returns the 0-based index of the value parameter in the parameter list of its containing function.
029 *
030 * @return the parameter index
031 */
032 int getIndex();
033
034 /**
035 * The front-end relies on this property when resolving function calls
036 *
037 * @return {@code true} iff the parameter has a default value, i.e. declares it or inherits
038 * by overriding a parameter in an overridden function.
039 */
040 boolean hasDefaultValue();
041
042 /**
043 * The back-end should relies on this property when generating function signatures
044 *
045 * @return {@code true} iff the parameter declares a default value, i.e. explicitly specifies it in the function header
046 */
047 boolean declaresDefaultValue();
048
049 @Nullable JetType getVarargElementType();
050
051 @NotNull
052 @Override
053 ValueParameterDescriptor getOriginal();
054
055 @NotNull
056 ValueParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner, @NotNull Name newName);
057
058 /**
059 * Parameter p1 overrides p2 iff
060 * a) their respective owners (function declarations) f1 override f2
061 * b) p1 and p2 have the same indices in the owners' parameter lists
062 */
063 @NotNull
064 @Override
065 Set<? extends ValueParameterDescriptor> getOverriddenDescriptors();
066
067 void addOverriddenDescriptor(@NotNull ValueParameterDescriptor overridden);
068 }