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.impl;
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.name.Name;
024    import org.jetbrains.kotlin.types.JetType;
025    
026    import java.util.Collection;
027    import java.util.Collections;
028    import java.util.List;
029    
030    public abstract class VariableDescriptorImpl extends DeclarationDescriptorNonRootImpl implements VariableDescriptor {
031        protected JetType outType;
032    
033        public VariableDescriptorImpl(
034                @NotNull DeclarationDescriptor containingDeclaration,
035                @NotNull Annotations annotations,
036                @NotNull Name name,
037                @Nullable JetType outType,
038                @NotNull SourceElement source
039        ) {
040            super(containingDeclaration, annotations, name, source);
041    
042            this.outType = outType;
043        }
044    
045        @NotNull
046        @Override
047        public JetType getType() {
048            return outType;
049        }
050    
051        public void setOutType(JetType outType) {
052            assert this.outType == null;
053            this.outType = outType;
054        }
055    
056        @Override
057        @NotNull
058        public VariableDescriptor getOriginal() {
059            return (VariableDescriptor) super.getOriginal();
060        }
061    
062        @NotNull
063        @Override
064        public List<ValueParameterDescriptor> getValueParameters() {
065            return Collections.emptyList();
066        }
067    
068        @Override
069        public boolean hasStableParameterNames() {
070            return false;
071        }
072    
073        @Override
074        public boolean hasSynthesizedParameterNames() {
075            return false;
076        }
077    
078        @NotNull
079        @Override
080        public Collection<? extends CallableDescriptor> getOverriddenDescriptors() {
081            return Collections.emptySet();
082        }
083    
084        @NotNull
085        @Override
086        public List<TypeParameterDescriptor> getTypeParameters() {
087            return Collections.emptyList();
088        }
089    
090        @Override
091        public ReceiverParameterDescriptor getExtensionReceiverParameter() {
092            return null;
093        }
094    
095        @Override
096        public ReceiverParameterDescriptor getDispatchReceiverParameter() {
097            return null;
098        }
099    
100        @NotNull
101        @Override
102        public JetType getReturnType() {
103            return getType();
104        }
105    
106        @Override
107        public boolean isConst() {
108            return false;
109        }
110    }