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.types.error;
018
019 import org.jetbrains.annotations.NotNull;
020 import org.jetbrains.annotations.Nullable;
021 import org.jetbrains.kotlin.descriptors.*;
022 import org.jetbrains.kotlin.descriptors.annotations.Annotations;
023 import org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl;
024 import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl;
025 import org.jetbrains.kotlin.name.Name;
026 import org.jetbrains.kotlin.types.ErrorUtils;
027
028 import java.util.List;
029
030 public class ErrorSimpleFunctionDescriptorImpl extends SimpleFunctionDescriptorImpl {
031 // used for diagnostic only
032 @SuppressWarnings({"UnusedDeclaration", "FieldCanBeLocal"})
033 private final ErrorUtils.ErrorScope ownerScope;
034
035 public ErrorSimpleFunctionDescriptorImpl(@NotNull ClassDescriptor containingDeclaration, @NotNull ErrorUtils.ErrorScope ownerScope) {
036 super(containingDeclaration, null, Annotations.Companion.getEMPTY(), Name.special("<ERROR FUNCTION>"), Kind.DECLARATION, SourceElement.NO_SOURCE);
037 this.ownerScope = ownerScope;
038 }
039
040 @NotNull
041 @Override
042 protected FunctionDescriptorImpl createSubstitutedCopy(
043 @NotNull DeclarationDescriptor newOwner,
044 @Nullable FunctionDescriptor original,
045 @NotNull Kind kind,
046 @Nullable Name newName,
047 boolean preserveSource
048 ) {
049 return this;
050 }
051
052 @NotNull
053 @Override
054 public SimpleFunctionDescriptor copy(DeclarationDescriptor newOwner, Modality modality, Visibility visibility, Kind kind, boolean copyOverrides) {
055 return this;
056 }
057
058 @NotNull
059 @Override
060 public SimpleFunctionDescriptor createRenamedCopy(@NotNull Name name) {
061 return this;
062 }
063
064 @NotNull
065 @Override
066 public SimpleFunctionDescriptor createCopyWithNewValueParameters(@NotNull List<ValueParameterDescriptor> valueParameters) {
067 return this;
068 }
069
070 @NotNull
071 @Override
072 public SimpleFunctionDescriptor createCopyWithNewTypeParameters(@NotNull List<TypeParameterDescriptor> typeParameters) {
073 return this;
074 }
075
076 @NotNull
077 @Override
078 public SimpleFunctionDescriptor createHiddenCopyToOvercomeSignatureClash() {
079 return this;
080 }
081
082 @Override
083 public void addOverriddenDescriptor(@NotNull CallableMemberDescriptor overriddenFunction) {
084 // nop
085 }
086 }