Refactoring. Convert Annotated to kotlin.

This commit is contained in:
Stanislav Erokhin
2016-05-19 19:00:51 +03:00
parent 450ea78b1d
commit 74bddcfb70
22 changed files with 47 additions and 78 deletions
@@ -42,7 +42,7 @@ class DeserializedType(
private fun ProtoBuf.Type.collectAllArguments(): List<ProtoBuf.Type.Argument> =
argumentList + outerType(c.typeTable)?.collectAllArguments().orEmpty()
private val annotations = DeserializedAnnotationsWithPossibleTargets(c.storageManager) {
override val annotations = DeserializedAnnotationsWithPossibleTargets(c.storageManager) {
c.components.annotationAndConstantLoader
.loadTypeAnnotations(typeProto, c.nameResolver)
.map { AnnotationWithTarget(it, null) } + additionalAnnotations.getAllAnnotations()
@@ -56,8 +56,6 @@ class DeserializedType(
return descriptor != null && ErrorUtils.isError(descriptor)
}
override fun getAnnotations(): Annotations = annotations
override val capabilities: TypeCapabilities get() = typeCapabilities()
private val typeCapabilities = c.storageManager.createLazyValue {
@@ -86,7 +86,7 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo
override fun isCompanionObject() = false
override fun isData() = false
override fun getAnnotations() = Annotations.EMPTY
override val annotations: Annotations get() = Annotations.EMPTY
override fun getUnsubstitutedMemberScope() = MemberScope.Empty
override fun getStaticScope() = MemberScope.Empty
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,7 +72,7 @@ class DeserializedClassDescriptor(
(containingDeclaration as? DeserializedClassDescriptor)?.thisAsProtoContainer
)
private val annotations =
override val annotations =
if (!Flags.HAS_ANNOTATIONS.get(classProto.flags)) {
Annotations.EMPTY
}
@@ -94,8 +94,6 @@ class DeserializedClassDescriptor(
override fun isData() = Flags.IS_DATA.get(classProto.flags)
override fun getAnnotations() = annotations
override fun getUnsubstitutedMemberScope(): MemberScope = memberScope
override fun getStaticScope() = staticScope
@@ -178,7 +176,7 @@ class DeserializedClassDescriptor(
override fun getDeclarationDescriptor() = this@DeserializedClassDescriptor
override fun getAnnotations(): Annotations = Annotations.EMPTY // TODO
override val annotations: Annotations get() = Annotations.EMPTY // TODO
override fun toString() = getName().toString()
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,14 +36,12 @@ class DeserializedTypeParameterDescriptor(
c.storageManager, c.containingDeclaration, c.nameResolver.getName(proto.name),
Deserialization.variance(proto.variance), proto.reified, index, SourceElement.NO_SOURCE, SupertypeLoopChecker.EMPTY
) {
private val annotations = DeserializedAnnotationsWithPossibleTargets(c.storageManager) {
override val annotations = DeserializedAnnotationsWithPossibleTargets(c.storageManager) {
c.components.annotationAndConstantLoader
.loadTypeParameterAnnotations(proto, c.nameResolver)
.map { AnnotationWithTarget(it, null) }
}
override fun getAnnotations(): Annotations = annotations
override fun resolveUpperBounds(): List<KotlinType> {
val upperBounds = proto.upperBounds(c.typeTable)
if (upperBounds.isEmpty()) {