diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/annotation/AnnotatedWithOnlyTargetedAnnotations.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/annotation/AnnotatedWithOnlyTargetedAnnotations.kt index d336d4dd52c..443be823075 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/annotation/AnnotatedWithOnlyTargetedAnnotations.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/annotation/AnnotatedWithOnlyTargetedAnnotations.kt @@ -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. @@ -26,14 +26,10 @@ interface WrappedAnnotated : Annotated { val originalAnnotated: Annotated } -class AnnotatedWithFakeAnnotations(override val originalAnnotated: Annotated, private val actual: Annotations) : WrappedAnnotated { - override fun getAnnotations() = actual -} +class AnnotatedWithFakeAnnotations(override val originalAnnotated: Annotated, override val annotations: Annotations) : WrappedAnnotated class AnnotatedWithOnlyTargetedAnnotations(original: Annotated) : Annotated { - private val annotations: Annotations = UseSiteTargetedAnnotations(original.annotations) - - override fun getAnnotations() = annotations + override val annotations: Annotations = UseSiteTargetedAnnotations(original.annotations) private class UseSiteTargetedAnnotations(private val additionalAnnotations: Annotations) : Annotations { override fun isEmpty() = true diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt index 0950955213c..ec3fc919d3b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt @@ -179,7 +179,7 @@ class FunctionDescriptorResolver( functionDescriptor.isExternal = function.hasModifier(KtTokens.EXTERNAL_KEYWORD) functionDescriptor.isInline = function.hasModifier(KtTokens.INLINE_KEYWORD) functionDescriptor.isTailrec = function.hasModifier(KtTokens.TAILREC_KEYWORD) - receiverType?.let { ForceResolveUtil.forceResolveAllContents(it.getAnnotations()) } + receiverType?.let { ForceResolveUtil.forceResolveAllContents(it.annotations) } for (valueParameterDescriptor in valueParameterDescriptors) { ForceResolveUtil.forceResolveAllContents(valueParameterDescriptor.type.annotations) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeProviderImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeProviderImpl.kt index 3e9c2bb84d9..5ab36f76236 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeProviderImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/FileScopeProviderImpl.kt @@ -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. @@ -202,7 +202,7 @@ open class FileScopeProviderImpl( override fun getSource() = sourceElement override fun getOriginal() = this - override fun getAnnotations() = Annotations.EMPTY + override val annotations: Annotations get() = Annotations.EMPTY override fun substitute(substitutor: TypeSubstitutor) = this override fun accept(visitor: DeclarationDescriptorVisitor?, data: D): R { diff --git a/compiler/tests-common/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt b/compiler/tests-common/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt index 0049ba6aa22..d2f9b9391bc 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt +++ b/compiler/tests-common/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.cli.common.output.outputUtils.writeAllTo import org.jetbrains.kotlin.codegen.GenerationUtils import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.incremental.components.LookupLocation import org.jetbrains.kotlin.jvm.compiler.ExpectedLoadErrorsUtil import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil @@ -214,8 +215,9 @@ abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdir() { override fun getOriginal() = throw UnsupportedOperationException() override fun substitute(substitutor: TypeSubstitutor) = throw UnsupportedOperationException() override fun acceptVoid(visitor: DeclarationDescriptorVisitor?) = throw UnsupportedOperationException() - override fun getAnnotations() = throw UnsupportedOperationException() override fun getName() = throw UnsupportedOperationException() + override val annotations: Annotations + get() = throw UnsupportedOperationException() override val fragments: Nothing get() = throw UnsupportedOperationException() } diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt index 1d0946b7e4d..0b6dff8e7d3 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt @@ -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. @@ -26,7 +26,10 @@ import org.jetbrains.kotlin.load.java.JvmAnnotationNames import org.jetbrains.kotlin.load.java.components.JavaResolverCache import org.jetbrains.kotlin.load.java.components.TypeUsage import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor -import org.jetbrains.kotlin.load.java.lazy.* +import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext +import org.jetbrains.kotlin.load.java.lazy.child +import org.jetbrains.kotlin.load.java.lazy.replaceComponents +import org.jetbrains.kotlin.load.java.lazy.resolveAnnotations import org.jetbrains.kotlin.load.java.lazy.types.toAttributes import org.jetbrains.kotlin.load.java.structure.JavaClass import org.jetbrains.kotlin.load.java.structure.JavaClassifierType @@ -40,6 +43,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe import org.jetbrains.kotlin.resolve.scopes.InnerClassesScopeWrapper import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.serialization.deserialization.NotFoundClasses +import org.jetbrains.kotlin.storage.getValue import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.utils.addIfNotNull import org.jetbrains.kotlin.utils.toReadOnlyList @@ -106,8 +110,7 @@ class LazyJavaClassDescriptor( override fun getConstructors() = unsubstitutedMemberScope.constructors() - private val annotations = c.storageManager.createLazyValue { c.resolveAnnotations(jClass) } - override fun getAnnotations() = annotations() + override val annotations by c.storageManager.createLazyValue { c.resolveAnnotations(jClass) } private val functionTypeForSamInterface = c.storageManager.createNullableLazyValue { c.components.samConversionResolver.resolveFunctionTypeIfSamInterface(this) @@ -200,7 +203,7 @@ class LazyJavaClassDescriptor( private fun getPurelyImplementsFqNameFromAnnotation(): FqName? { val annotation = - this@LazyJavaClassDescriptor.getAnnotations().findAnnotation(JvmAnnotationNames.PURELY_IMPLEMENTS_ANNOTATION) + this@LazyJavaClassDescriptor.annotations.findAnnotation(JvmAnnotationNames.PURELY_IMPLEMENTS_ANNOTATION) ?: return null val fqNameString = (annotation.allValueArguments.values.singleOrNull() as? StringValue)?.value ?: return null @@ -212,7 +215,7 @@ class LazyJavaClassDescriptor( override val supertypeLoopChecker: SupertypeLoopChecker get() = c.components.supertypeLoopChecker - override fun getAnnotations() = Annotations.EMPTY + override val annotations: Annotations get() = Annotations.EMPTY override fun isFinal(): Boolean = isFinalClass diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt index cefcea5fc02..588b1cbea62 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt @@ -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. @@ -243,7 +243,7 @@ abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) : MemberS val propertyDescriptor = createPropertyDescriptor(field) propertyDescriptor.initialize(null, null) - val propertyType = getPropertyType(field, propertyDescriptor.getAnnotations()) + val propertyType = getPropertyType(field, propertyDescriptor.annotations) propertyDescriptor.setType(propertyType, listOf(), getDispatchReceiverParameter(), null as KotlinType?) diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaTypeParameterDescriptor.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaTypeParameterDescriptor.kt index e0eb140bcc8..d1cd72d1012 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaTypeParameterDescriptor.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaTypeParameterDescriptor.kt @@ -42,9 +42,7 @@ class LazyJavaTypeParameterDescriptor( index, SourceElement.NO_SOURCE, c.components.supertypeLoopChecker ) { - private val annotations = LazyJavaAnnotations(c, javaTypeParameter) - - override fun getAnnotations() = annotations + override val annotations = LazyJavaAnnotations(c, javaTypeParameter) override fun resolveUpperBounds(): List { val bounds = javaTypeParameter.upperBounds diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/LazyJavaTypeResolver.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/LazyJavaTypeResolver.kt index e819be3e368..2b96a2e5f9e 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/LazyJavaTypeResolver.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/LazyJavaTypeResolver.kt @@ -98,7 +98,7 @@ class LazyJavaTypeResolver( private val javaType: JavaClassifierType, private val attr: JavaTypeAttributes ) : AbstractLazyType(c.storageManager) { - private val annotations = CompositeAnnotations(listOf(LazyJavaAnnotations(c, javaType), attr.typeAnnotations)) + override val annotations = CompositeAnnotations(listOf(LazyJavaAnnotations(c, javaType), attr.typeAnnotations)) private val classifier = c.storageManager.createNullableLazyValue { javaType.classifier } @@ -278,8 +278,6 @@ class LazyJavaTypeResolver( } override val isMarkedNullable: Boolean get() = nullable() - - override fun getAnnotations() = annotations } object FlexibleJavaClassifierTypeFactory : FlexibleTypeFactory { diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/typeEnhancement/typeEnhancement.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/typeEnhancement/typeEnhancement.kt index 0c169e43576..254bed5c7dd 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/typeEnhancement/typeEnhancement.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/typeEnhancement/typeEnhancement.kt @@ -116,7 +116,7 @@ private fun KotlinType.enhanceInflexible(qualifiers: (Int) -> JavaTypeQualifiers if (!wereChanges) return Result(this, subtreeSize, wereChanges = false) val newAnnotations = listOf( - getAnnotations(), + annotations, enhancedMutabilityAnnotations, enhancedNullabilityAnnotations ).filterNotNull().compositeAnnotationsOrSingle() diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassDescriptor.kt b/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassDescriptor.kt index 801fbc185f4..e4c66ed9038 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassDescriptor.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/functions/FunctionClassDescriptor.kt @@ -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. @@ -101,7 +101,7 @@ class FunctionClassDescriptor( override fun isCompanionObject() = false override fun isInner() = false override fun isData() = false - override fun getAnnotations() = Annotations.EMPTY + override val annotations: Annotations get() = Annotations.EMPTY override fun getSource() = SourceElement.NO_SOURCE override fun getDeclaredTypeParameters() = parameters @@ -143,7 +143,7 @@ class FunctionClassDescriptor( override fun getDeclarationDescriptor() = this@FunctionClassDescriptor override fun isDenotable() = true override fun isFinal() = false - override fun getAnnotations() = Annotations.EMPTY + override val annotations: Annotations get() = Annotations.EMPTY override fun toString() = declarationDescriptor.toString() diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/Annotated.java b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/Annotated.java deleted file mode 100644 index a4658dd1bf7..00000000000 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/Annotated.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2010-2015 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.descriptors.annotations; - -import org.jetbrains.annotations.NotNull; - -public interface Annotated { - @NotNull - Annotations getAnnotations(); -} diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/Annotations.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/Annotations.kt index 258f02b3134..ee93fa5a29b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/Annotations.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/Annotations.kt @@ -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. @@ -20,6 +20,10 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.resolve.DescriptorUtils +interface Annotated { + val annotations: Annotations +} + interface Annotations : Iterable { fun isEmpty(): Boolean diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/CapturedTypeConstructor.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/CapturedTypeConstructor.kt index ca9b23ac7b6..59a7fc165cd 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/CapturedTypeConstructor.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/CapturedTypeConstructor.kt @@ -49,7 +49,7 @@ class CapturedTypeConstructor( override fun getDeclarationDescriptor() = null - override fun getAnnotations() = Annotations.EMPTY + override val annotations: Annotations get() = Annotations.EMPTY override fun toString() = "CapturedTypeConstructor($typeProjection)" diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/IntegerValueTypeConstructor.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/IntegerValueTypeConstructor.kt index 61ed8e446eb..adc87667547 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/IntegerValueTypeConstructor.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/constants/IntegerValueTypeConstructor.kt @@ -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. @@ -55,7 +55,7 @@ class IntegerValueTypeConstructor( override fun getDeclarationDescriptor() = null - override fun getAnnotations() = Annotations.EMPTY + override val annotations: Annotations get() = Annotations.EMPTY fun getValue(): Long = value diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/AbstractLazyType.kt b/core/descriptors/src/org/jetbrains/kotlin/types/AbstractLazyType.kt index 67e615480b2..770ca094541 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/AbstractLazyType.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/AbstractLazyType.kt @@ -54,7 +54,7 @@ abstract class AbstractLazyType(storageManager: StorageManager) : AbstractKotlin override val isError: Boolean get() = constructor.declarationDescriptor?.let { d -> ErrorUtils.isError(d) } ?: false - override fun getAnnotations() = Annotations.EMPTY + override val annotations: Annotations get() = Annotations.EMPTY override fun toString() = when { !typeConstructor.isComputed() -> "[Not-computed]" diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/FunctionPlaceholders.kt b/core/descriptors/src/org/jetbrains/kotlin/types/FunctionPlaceholders.kt index 3f38231ae08..aee6d91fb56 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/FunctionPlaceholders.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/FunctionPlaceholders.kt @@ -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. @@ -65,7 +65,7 @@ class FunctionPlaceholderTypeConstructor( return errorTypeConstructor.declarationDescriptor } - override fun getAnnotations(): Annotations { + override val annotations: Annotations get(): Annotations { return errorTypeConstructor.annotations } diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/KotlinTypeImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/types/KotlinTypeImpl.kt index 8c5420ace79..81e7104016c 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/KotlinTypeImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/KotlinTypeImpl.kt @@ -22,7 +22,7 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope open class KotlinTypeImpl private constructor( - private val annotations: Annotations, + override val annotations: Annotations, override val constructor: TypeConstructor, override val isMarkedNullable: Boolean, override val arguments: List, @@ -76,7 +76,5 @@ private constructor( } } - override fun getAnnotations() = annotations - override val isError: Boolean get() = false } diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt index 2786b021fde..233184f778e 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/TypeUtils.kt @@ -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. @@ -90,7 +90,7 @@ fun KotlinType.replaceAnnotations(newAnnotations: Annotations): KotlinType { return object : DelegatingType() { override fun getDelegate() = this@replaceAnnotations - override fun getAnnotations() = newAnnotations + override val annotations = newAnnotations } } diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/DeserializedType.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/DeserializedType.kt index c5416aeeda6..566b6f451a9 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/DeserializedType.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/DeserializedType.kt @@ -42,7 +42,7 @@ class DeserializedType( private fun ProtoBuf.Type.collectAllArguments(): List = 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 { diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/NotFoundClasses.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/NotFoundClasses.kt index ede3f0e7700..e2bd71059a6 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/NotFoundClasses.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/NotFoundClasses.kt @@ -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 diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt index 2bf98228f07..47da2300713 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedClassDescriptor.kt @@ -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() diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedTypeParameterDescriptor.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedTypeParameterDescriptor.kt index 07f8341c2c6..378598870ab 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedTypeParameterDescriptor.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/descriptors/DeserializedTypeParameterDescriptor.kt @@ -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 { val upperBounds = proto.upperBounds(c.typeTable) if (upperBounds.isEmpty()) {