private JetClassLikeInfo enumClassObjectInfo(JetClassLikeInfo classLikeInfo) { return new FilteringClassLikeInfo( resolveSession.getStorageManager(), classLikeInfo, ONLY_ENUM_ENTRIES) { @Override public JetClassOrObject getCorrespondingClassOrObject() { return null; } @NotNull @Override public ClassKind getClassKind() { return ClassKind.CLASS_OBJECT; } @NotNull @Override public List<? extends JetParameter> getPrimaryConstructorParameters() { return Collections.emptyList(); } @NotNull @Override public List<JetTypeParameter> getTypeParameters() { return Collections.emptyList(); } }; }
public LazyTypeParameterDescriptor( @NotNull ResolveSession resolveSession, @NotNull LazyClassDescriptor containingDeclaration, @NotNull JetTypeParameter jetTypeParameter, int index) { super( resolveSession.getStorageManager(), containingDeclaration, jetTypeParameter.getNameAsSafeName(), jetTypeParameter.getVariance(), jetTypeParameter.hasModifier(JetTokens.REIFIED_KEYWORD), index, toSourceElement(jetTypeParameter)); this.resolveSession = resolveSession; this.jetTypeParameter = jetTypeParameter; this.resolveSession.getTrace().record(BindingContext.TYPE_PARAMETER, jetTypeParameter, this); }
public LazyClassDescriptor( @NotNull ResolveSession resolveSession, @NotNull DeclarationDescriptor containingDeclaration, @NotNull Name name, @NotNull JetClassLikeInfo classLikeInfo) { super(containingDeclaration, name); this.resolveSession = resolveSession; if (classLikeInfo.getCorrespondingClassOrObject() != null) { this.resolveSession .getTrace() .record(BindingContext.CLASS, classLikeInfo.getCorrespondingClassOrObject(), this); } this.originalClassInfo = classLikeInfo; JetClassLikeInfo classLikeInfoForMembers = classLikeInfo.getClassKind() != ClassKind.ENUM_CLASS ? classLikeInfo : noEnumEntries(classLikeInfo); this.declarationProvider = resolveSession .getDeclarationProviderFactory() .getClassMemberDeclarationProvider(classLikeInfoForMembers); this.unsubstitutedMemberScope = new LazyClassMemberScope(resolveSession, declarationProvider, this); this.unsubstitutedInnerClassesScope = new InnerClassesScopeWrapper(unsubstitutedMemberScope); this.typeConstructor = new LazyClassTypeConstructor(); JetModifierList modifierList = classLikeInfo.getModifierList(); this.kind = classLikeInfo.getClassKind(); if (kind.isObject()) { this.modality = Modality.FINAL; } else { Modality defaultModality = kind == ClassKind.TRAIT ? Modality.ABSTRACT : Modality.FINAL; this.modality = resolveModalityFromModifiers(modifierList, defaultModality); } this.visibility = resolveVisibilityFromModifiers(modifierList, getDefaultClassVisibility(this)); this.isInner = isInnerClass(modifierList); StorageManager storageManager = resolveSession.getStorageManager(); this.thisAsReceiverParameter = storageManager.createLazyValue( new Function0<ReceiverParameterDescriptor>() { @Override public ReceiverParameterDescriptor invoke() { return DescriptorFactory.createLazyReceiverParameterDescriptor( LazyClassDescriptor.this); } }); this.annotations = storageManager.createLazyValue( new Function0<List<AnnotationDescriptor>>() { @Override public List<AnnotationDescriptor> invoke() { return resolveAnnotations(); } }); this.classObjectDescriptor = storageManager.createNullableLazyValue( new Function0<ClassDescriptor>() { @Override public ClassDescriptor invoke() { return computeClassObjectDescriptor(); } }); this.scopeForClassHeaderResolution = storageManager.createLazyValue( new Function0<JetScope>() { @Override public JetScope invoke() { return computeScopeForClassHeaderResolution(); } }); this.scopeForMemberDeclarationResolution = storageManager.createLazyValue( new Function0<JetScope>() { @Override public JetScope invoke() { return computeScopeForMemberDeclarationResolution(); } }); this.scopeForPropertyInitializerResolution = storageManager.createLazyValue( new Function0<JetScope>() { @Override public JetScope invoke() { return computeScopeForPropertyInitializerResolution(); } }); }
private JetClassLikeInfo noEnumEntries(JetClassLikeInfo classLikeInfo) { return new FilteringClassLikeInfo( resolveSession.getStorageManager(), classLikeInfo, Predicates.not(ONLY_ENUM_ENTRIES)); }