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.annotations.ReadOnly; 022 import org.jetbrains.kotlin.resolve.scopes.MemberScope; 023 import org.jetbrains.kotlin.types.KotlinType; 024 import org.jetbrains.kotlin.types.TypeProjection; 025 import org.jetbrains.kotlin.types.TypeSubstitution; 026 import org.jetbrains.kotlin.types.TypeSubstitutor; 027 028 import java.util.Collection; 029 import java.util.List; 030 031 public interface ClassDescriptor extends ClassifierDescriptor, MemberDescriptor, ClassOrPackageFragmentDescriptor { 032 @NotNull 033 MemberScope getMemberScope(@NotNull List<? extends TypeProjection> typeArguments); 034 035 @NotNull 036 MemberScope getMemberScope(@NotNull TypeSubstitution typeSubstitution); 037 038 @NotNull 039 MemberScope getUnsubstitutedMemberScope(); 040 041 @NotNull 042 MemberScope getUnsubstitutedInnerClassesScope(); 043 044 @NotNull 045 MemberScope getStaticScope(); 046 047 @NotNull 048 @ReadOnly 049 Collection<ConstructorDescriptor> getConstructors(); 050 051 @Override 052 @NotNull 053 DeclarationDescriptor getContainingDeclaration(); 054 055 /** 056 * @return type A<T> for the class A<T> 057 */ 058 @NotNull 059 @Override 060 KotlinType getDefaultType(); 061 062 @NotNull 063 @Override 064 ClassDescriptor substitute(@NotNull TypeSubstitutor substitutor); 065 066 /** 067 * @return nested object declared as 'companion' if one is present. 068 */ 069 @Nullable 070 ClassDescriptor getCompanionObjectDescriptor(); 071 072 @NotNull 073 ClassKind getKind(); 074 075 @Override 076 @NotNull 077 Modality getModality(); 078 079 @Override 080 @NotNull 081 Visibility getVisibility(); 082 083 /** 084 * @return <code>true</code> if this class contains a reference to its outer class (as opposed to static nested class) 085 */ 086 boolean isInner(); 087 088 boolean isCompanionObject(); 089 090 boolean isData(); 091 092 @NotNull 093 ReceiverParameterDescriptor getThisAsReceiverParameter(); 094 095 @Nullable 096 ConstructorDescriptor getUnsubstitutedPrimaryConstructor(); 097 098 /** 099 * It may differ from 'typeConstructor.parameters' in current class is inner, 'typeConstructor.parameters' contains 100 * captured parameters from outer declaration. 101 * @return list of type parameters actually declared type parameters in current class 102 */ 103 @ReadOnly 104 @NotNull 105 List<TypeParameterDescriptor> getDeclaredTypeParameters(); 106 }