Refactoring. Convert Annotated to kotlin.
This commit is contained in:
+3
-7
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -26,14 +26,10 @@ interface WrappedAnnotated : Annotated {
|
|||||||
val originalAnnotated: Annotated
|
val originalAnnotated: Annotated
|
||||||
}
|
}
|
||||||
|
|
||||||
class AnnotatedWithFakeAnnotations(override val originalAnnotated: Annotated, private val actual: Annotations) : WrappedAnnotated {
|
class AnnotatedWithFakeAnnotations(override val originalAnnotated: Annotated, override val annotations: Annotations) : WrappedAnnotated
|
||||||
override fun getAnnotations() = actual
|
|
||||||
}
|
|
||||||
|
|
||||||
class AnnotatedWithOnlyTargetedAnnotations(original: Annotated) : Annotated {
|
class AnnotatedWithOnlyTargetedAnnotations(original: Annotated) : Annotated {
|
||||||
private val annotations: Annotations = UseSiteTargetedAnnotations(original.annotations)
|
override val annotations: Annotations = UseSiteTargetedAnnotations(original.annotations)
|
||||||
|
|
||||||
override fun getAnnotations() = annotations
|
|
||||||
|
|
||||||
private class UseSiteTargetedAnnotations(private val additionalAnnotations: Annotations) : Annotations {
|
private class UseSiteTargetedAnnotations(private val additionalAnnotations: Annotations) : Annotations {
|
||||||
override fun isEmpty() = true
|
override fun isEmpty() = true
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ class FunctionDescriptorResolver(
|
|||||||
functionDescriptor.isExternal = function.hasModifier(KtTokens.EXTERNAL_KEYWORD)
|
functionDescriptor.isExternal = function.hasModifier(KtTokens.EXTERNAL_KEYWORD)
|
||||||
functionDescriptor.isInline = function.hasModifier(KtTokens.INLINE_KEYWORD)
|
functionDescriptor.isInline = function.hasModifier(KtTokens.INLINE_KEYWORD)
|
||||||
functionDescriptor.isTailrec = function.hasModifier(KtTokens.TAILREC_KEYWORD)
|
functionDescriptor.isTailrec = function.hasModifier(KtTokens.TAILREC_KEYWORD)
|
||||||
receiverType?.let { ForceResolveUtil.forceResolveAllContents(it.getAnnotations()) }
|
receiverType?.let { ForceResolveUtil.forceResolveAllContents(it.annotations) }
|
||||||
for (valueParameterDescriptor in valueParameterDescriptors) {
|
for (valueParameterDescriptor in valueParameterDescriptors) {
|
||||||
ForceResolveUtil.forceResolveAllContents(valueParameterDescriptor.type.annotations)
|
ForceResolveUtil.forceResolveAllContents(valueParameterDescriptor.type.annotations)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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 getSource() = sourceElement
|
||||||
|
|
||||||
override fun getOriginal() = this
|
override fun getOriginal() = this
|
||||||
override fun getAnnotations() = Annotations.EMPTY
|
override val annotations: Annotations get() = Annotations.EMPTY
|
||||||
override fun substitute(substitutor: TypeSubstitutor) = this
|
override fun substitute(substitutor: TypeSubstitutor) = this
|
||||||
|
|
||||||
override fun <R : Any?, D : Any?> accept(visitor: DeclarationDescriptorVisitor<R, D>?, data: D): R {
|
override fun <R : Any?, D : Any?> accept(visitor: DeclarationDescriptorVisitor<R, D>?, data: D): R {
|
||||||
|
|||||||
+3
-1
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.cli.common.output.outputUtils.writeAllTo
|
|||||||
import org.jetbrains.kotlin.codegen.GenerationUtils
|
import org.jetbrains.kotlin.codegen.GenerationUtils
|
||||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.jvm.compiler.ExpectedLoadErrorsUtil
|
import org.jetbrains.kotlin.jvm.compiler.ExpectedLoadErrorsUtil
|
||||||
import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil
|
import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil
|
||||||
@@ -214,8 +215,9 @@ abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdir() {
|
|||||||
override fun getOriginal() = throw UnsupportedOperationException()
|
override fun getOriginal() = throw UnsupportedOperationException()
|
||||||
override fun substitute(substitutor: TypeSubstitutor) = throw UnsupportedOperationException()
|
override fun substitute(substitutor: TypeSubstitutor) = throw UnsupportedOperationException()
|
||||||
override fun acceptVoid(visitor: DeclarationDescriptorVisitor<Void, Void>?) = throw UnsupportedOperationException()
|
override fun acceptVoid(visitor: DeclarationDescriptorVisitor<Void, Void>?) = throw UnsupportedOperationException()
|
||||||
override fun getAnnotations() = throw UnsupportedOperationException()
|
|
||||||
override fun getName() = throw UnsupportedOperationException()
|
override fun getName() = throw UnsupportedOperationException()
|
||||||
|
override val annotations: Annotations
|
||||||
|
get() = throw UnsupportedOperationException()
|
||||||
override val fragments: Nothing
|
override val fragments: Nothing
|
||||||
get() = throw UnsupportedOperationException()
|
get() = throw UnsupportedOperationException()
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-6
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.JavaResolverCache
|
||||||
import org.jetbrains.kotlin.load.java.components.TypeUsage
|
import org.jetbrains.kotlin.load.java.components.TypeUsage
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
|
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.lazy.types.toAttributes
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
import org.jetbrains.kotlin.load.java.structure.JavaClass
|
||||||
import org.jetbrains.kotlin.load.java.structure.JavaClassifierType
|
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.InnerClassesScopeWrapper
|
||||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.NotFoundClasses
|
import org.jetbrains.kotlin.serialization.deserialization.NotFoundClasses
|
||||||
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||||
@@ -106,8 +110,7 @@ class LazyJavaClassDescriptor(
|
|||||||
|
|
||||||
override fun getConstructors() = unsubstitutedMemberScope.constructors()
|
override fun getConstructors() = unsubstitutedMemberScope.constructors()
|
||||||
|
|
||||||
private val annotations = c.storageManager.createLazyValue { c.resolveAnnotations(jClass) }
|
override val annotations by c.storageManager.createLazyValue { c.resolveAnnotations(jClass) }
|
||||||
override fun getAnnotations() = annotations()
|
|
||||||
|
|
||||||
private val functionTypeForSamInterface = c.storageManager.createNullableLazyValue {
|
private val functionTypeForSamInterface = c.storageManager.createNullableLazyValue {
|
||||||
c.components.samConversionResolver.resolveFunctionTypeIfSamInterface(this)
|
c.components.samConversionResolver.resolveFunctionTypeIfSamInterface(this)
|
||||||
@@ -200,7 +203,7 @@ class LazyJavaClassDescriptor(
|
|||||||
|
|
||||||
private fun getPurelyImplementsFqNameFromAnnotation(): FqName? {
|
private fun getPurelyImplementsFqNameFromAnnotation(): FqName? {
|
||||||
val annotation =
|
val annotation =
|
||||||
this@LazyJavaClassDescriptor.getAnnotations().findAnnotation(JvmAnnotationNames.PURELY_IMPLEMENTS_ANNOTATION)
|
this@LazyJavaClassDescriptor.annotations.findAnnotation(JvmAnnotationNames.PURELY_IMPLEMENTS_ANNOTATION)
|
||||||
?: return null
|
?: return null
|
||||||
|
|
||||||
val fqNameString = (annotation.allValueArguments.values.singleOrNull() as? StringValue)?.value ?: return null
|
val fqNameString = (annotation.allValueArguments.values.singleOrNull() as? StringValue)?.value ?: return null
|
||||||
@@ -212,7 +215,7 @@ class LazyJavaClassDescriptor(
|
|||||||
override val supertypeLoopChecker: SupertypeLoopChecker
|
override val supertypeLoopChecker: SupertypeLoopChecker
|
||||||
get() = c.components.supertypeLoopChecker
|
get() = c.components.supertypeLoopChecker
|
||||||
|
|
||||||
override fun getAnnotations() = Annotations.EMPTY
|
override val annotations: Annotations get() = Annotations.EMPTY
|
||||||
|
|
||||||
override fun isFinal(): Boolean = isFinalClass
|
override fun isFinal(): Boolean = isFinalClass
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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)
|
val propertyDescriptor = createPropertyDescriptor(field)
|
||||||
propertyDescriptor.initialize(null, null)
|
propertyDescriptor.initialize(null, null)
|
||||||
|
|
||||||
val propertyType = getPropertyType(field, propertyDescriptor.getAnnotations())
|
val propertyType = getPropertyType(field, propertyDescriptor.annotations)
|
||||||
|
|
||||||
propertyDescriptor.setType(propertyType, listOf(), getDispatchReceiverParameter(), null as KotlinType?)
|
propertyDescriptor.setType(propertyType, listOf(), getDispatchReceiverParameter(), null as KotlinType?)
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -42,9 +42,7 @@ class LazyJavaTypeParameterDescriptor(
|
|||||||
index,
|
index,
|
||||||
SourceElement.NO_SOURCE, c.components.supertypeLoopChecker
|
SourceElement.NO_SOURCE, c.components.supertypeLoopChecker
|
||||||
) {
|
) {
|
||||||
private val annotations = LazyJavaAnnotations(c, javaTypeParameter)
|
override val annotations = LazyJavaAnnotations(c, javaTypeParameter)
|
||||||
|
|
||||||
override fun getAnnotations() = annotations
|
|
||||||
|
|
||||||
override fun resolveUpperBounds(): List<KotlinType> {
|
override fun resolveUpperBounds(): List<KotlinType> {
|
||||||
val bounds = javaTypeParameter.upperBounds
|
val bounds = javaTypeParameter.upperBounds
|
||||||
|
|||||||
+1
-3
@@ -98,7 +98,7 @@ class LazyJavaTypeResolver(
|
|||||||
private val javaType: JavaClassifierType,
|
private val javaType: JavaClassifierType,
|
||||||
private val attr: JavaTypeAttributes
|
private val attr: JavaTypeAttributes
|
||||||
) : AbstractLazyType(c.storageManager) {
|
) : 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 }
|
private val classifier = c.storageManager.createNullableLazyValue { javaType.classifier }
|
||||||
|
|
||||||
@@ -278,8 +278,6 @@ class LazyJavaTypeResolver(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val isMarkedNullable: Boolean get() = nullable()
|
override val isMarkedNullable: Boolean get() = nullable()
|
||||||
|
|
||||||
override fun getAnnotations() = annotations
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object FlexibleJavaClassifierTypeFactory : FlexibleTypeFactory {
|
object FlexibleJavaClassifierTypeFactory : FlexibleTypeFactory {
|
||||||
|
|||||||
+1
-1
@@ -116,7 +116,7 @@ private fun KotlinType.enhanceInflexible(qualifiers: (Int) -> JavaTypeQualifiers
|
|||||||
if (!wereChanges) return Result(this, subtreeSize, wereChanges = false)
|
if (!wereChanges) return Result(this, subtreeSize, wereChanges = false)
|
||||||
|
|
||||||
val newAnnotations = listOf(
|
val newAnnotations = listOf(
|
||||||
getAnnotations(),
|
annotations,
|
||||||
enhancedMutabilityAnnotations,
|
enhancedMutabilityAnnotations,
|
||||||
enhancedNullabilityAnnotations
|
enhancedNullabilityAnnotations
|
||||||
).filterNotNull().compositeAnnotationsOrSingle()
|
).filterNotNull().compositeAnnotationsOrSingle()
|
||||||
|
|||||||
+3
-3
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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 isCompanionObject() = false
|
||||||
override fun isInner() = false
|
override fun isInner() = false
|
||||||
override fun isData() = 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 getSource() = SourceElement.NO_SOURCE
|
||||||
|
|
||||||
override fun getDeclaredTypeParameters() = parameters
|
override fun getDeclaredTypeParameters() = parameters
|
||||||
@@ -143,7 +143,7 @@ class FunctionClassDescriptor(
|
|||||||
override fun getDeclarationDescriptor() = this@FunctionClassDescriptor
|
override fun getDeclarationDescriptor() = this@FunctionClassDescriptor
|
||||||
override fun isDenotable() = true
|
override fun isDenotable() = true
|
||||||
override fun isFinal() = false
|
override fun isFinal() = false
|
||||||
override fun getAnnotations() = Annotations.EMPTY
|
override val annotations: Annotations get() = Annotations.EMPTY
|
||||||
|
|
||||||
override fun toString() = declarationDescriptor.toString()
|
override fun toString() = declarationDescriptor.toString()
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.name.FqName
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
|
|
||||||
|
interface Annotated {
|
||||||
|
val annotations: Annotations
|
||||||
|
}
|
||||||
|
|
||||||
interface Annotations : Iterable<AnnotationDescriptor> {
|
interface Annotations : Iterable<AnnotationDescriptor> {
|
||||||
|
|
||||||
fun isEmpty(): Boolean
|
fun isEmpty(): Boolean
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ class CapturedTypeConstructor(
|
|||||||
|
|
||||||
override fun getDeclarationDescriptor() = null
|
override fun getDeclarationDescriptor() = null
|
||||||
|
|
||||||
override fun getAnnotations() = Annotations.EMPTY
|
override val annotations: Annotations get() = Annotations.EMPTY
|
||||||
|
|
||||||
override fun toString() = "CapturedTypeConstructor($typeProjection)"
|
override fun toString() = "CapturedTypeConstructor($typeProjection)"
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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 getDeclarationDescriptor() = null
|
||||||
|
|
||||||
override fun getAnnotations() = Annotations.EMPTY
|
override val annotations: Annotations get() = Annotations.EMPTY
|
||||||
|
|
||||||
fun getValue(): Long = value
|
fun getValue(): Long = value
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ abstract class AbstractLazyType(storageManager: StorageManager) : AbstractKotlin
|
|||||||
|
|
||||||
override val isError: Boolean get() = constructor.declarationDescriptor?.let { d -> ErrorUtils.isError(d) } ?: false
|
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 {
|
override fun toString() = when {
|
||||||
!typeConstructor.isComputed() -> "[Not-computed]"
|
!typeConstructor.isComputed() -> "[Not-computed]"
|
||||||
|
|||||||
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -65,7 +65,7 @@ class FunctionPlaceholderTypeConstructor(
|
|||||||
return errorTypeConstructor.declarationDescriptor
|
return errorTypeConstructor.declarationDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAnnotations(): Annotations {
|
override val annotations: Annotations get(): Annotations {
|
||||||
return errorTypeConstructor.annotations
|
return errorTypeConstructor.annotations
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
|||||||
|
|
||||||
open class KotlinTypeImpl
|
open class KotlinTypeImpl
|
||||||
private constructor(
|
private constructor(
|
||||||
private val annotations: Annotations,
|
override val annotations: Annotations,
|
||||||
override val constructor: TypeConstructor,
|
override val constructor: TypeConstructor,
|
||||||
override val isMarkedNullable: Boolean,
|
override val isMarkedNullable: Boolean,
|
||||||
override val arguments: List<TypeProjection>,
|
override val arguments: List<TypeProjection>,
|
||||||
@@ -76,7 +76,5 @@ private constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAnnotations() = annotations
|
|
||||||
|
|
||||||
override val isError: Boolean get() = false
|
override val isError: Boolean get() = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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() {
|
return object : DelegatingType() {
|
||||||
override fun getDelegate() = this@replaceAnnotations
|
override fun getDelegate() = this@replaceAnnotations
|
||||||
|
|
||||||
override fun getAnnotations() = newAnnotations
|
override val annotations = newAnnotations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -42,7 +42,7 @@ class DeserializedType(
|
|||||||
private fun ProtoBuf.Type.collectAllArguments(): List<ProtoBuf.Type.Argument> =
|
private fun ProtoBuf.Type.collectAllArguments(): List<ProtoBuf.Type.Argument> =
|
||||||
argumentList + outerType(c.typeTable)?.collectAllArguments().orEmpty()
|
argumentList + outerType(c.typeTable)?.collectAllArguments().orEmpty()
|
||||||
|
|
||||||
private val annotations = DeserializedAnnotationsWithPossibleTargets(c.storageManager) {
|
override val annotations = DeserializedAnnotationsWithPossibleTargets(c.storageManager) {
|
||||||
c.components.annotationAndConstantLoader
|
c.components.annotationAndConstantLoader
|
||||||
.loadTypeAnnotations(typeProto, c.nameResolver)
|
.loadTypeAnnotations(typeProto, c.nameResolver)
|
||||||
.map { AnnotationWithTarget(it, null) } + additionalAnnotations.getAllAnnotations()
|
.map { AnnotationWithTarget(it, null) } + additionalAnnotations.getAllAnnotations()
|
||||||
@@ -56,8 +56,6 @@ class DeserializedType(
|
|||||||
return descriptor != null && ErrorUtils.isError(descriptor)
|
return descriptor != null && ErrorUtils.isError(descriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAnnotations(): Annotations = annotations
|
|
||||||
|
|
||||||
override val capabilities: TypeCapabilities get() = typeCapabilities()
|
override val capabilities: TypeCapabilities get() = typeCapabilities()
|
||||||
|
|
||||||
private val typeCapabilities = c.storageManager.createLazyValue {
|
private val typeCapabilities = c.storageManager.createLazyValue {
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo
|
|||||||
|
|
||||||
override fun isCompanionObject() = false
|
override fun isCompanionObject() = false
|
||||||
override fun isData() = false
|
override fun isData() = false
|
||||||
override fun getAnnotations() = Annotations.EMPTY
|
override val annotations: Annotations get() = Annotations.EMPTY
|
||||||
|
|
||||||
override fun getUnsubstitutedMemberScope() = MemberScope.Empty
|
override fun getUnsubstitutedMemberScope() = MemberScope.Empty
|
||||||
override fun getStaticScope() = MemberScope.Empty
|
override fun getStaticScope() = MemberScope.Empty
|
||||||
|
|||||||
+3
-5
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -72,7 +72,7 @@ class DeserializedClassDescriptor(
|
|||||||
(containingDeclaration as? DeserializedClassDescriptor)?.thisAsProtoContainer
|
(containingDeclaration as? DeserializedClassDescriptor)?.thisAsProtoContainer
|
||||||
)
|
)
|
||||||
|
|
||||||
private val annotations =
|
override val annotations =
|
||||||
if (!Flags.HAS_ANNOTATIONS.get(classProto.flags)) {
|
if (!Flags.HAS_ANNOTATIONS.get(classProto.flags)) {
|
||||||
Annotations.EMPTY
|
Annotations.EMPTY
|
||||||
}
|
}
|
||||||
@@ -94,8 +94,6 @@ class DeserializedClassDescriptor(
|
|||||||
|
|
||||||
override fun isData() = Flags.IS_DATA.get(classProto.flags)
|
override fun isData() = Flags.IS_DATA.get(classProto.flags)
|
||||||
|
|
||||||
override fun getAnnotations() = annotations
|
|
||||||
|
|
||||||
override fun getUnsubstitutedMemberScope(): MemberScope = memberScope
|
override fun getUnsubstitutedMemberScope(): MemberScope = memberScope
|
||||||
|
|
||||||
override fun getStaticScope() = staticScope
|
override fun getStaticScope() = staticScope
|
||||||
@@ -178,7 +176,7 @@ class DeserializedClassDescriptor(
|
|||||||
|
|
||||||
override fun getDeclarationDescriptor() = this@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()
|
override fun toString() = getName().toString()
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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),
|
c.storageManager, c.containingDeclaration, c.nameResolver.getName(proto.name),
|
||||||
Deserialization.variance(proto.variance), proto.reified, index, SourceElement.NO_SOURCE, SupertypeLoopChecker.EMPTY
|
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
|
c.components.annotationAndConstantLoader
|
||||||
.loadTypeParameterAnnotations(proto, c.nameResolver)
|
.loadTypeParameterAnnotations(proto, c.nameResolver)
|
||||||
.map { AnnotationWithTarget(it, null) }
|
.map { AnnotationWithTarget(it, null) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAnnotations(): Annotations = annotations
|
|
||||||
|
|
||||||
override fun resolveUpperBounds(): List<KotlinType> {
|
override fun resolveUpperBounds(): List<KotlinType> {
|
||||||
val upperBounds = proto.upperBounds(c.typeTable)
|
val upperBounds = proto.upperBounds(c.typeTable)
|
||||||
if (upperBounds.isEmpty()) {
|
if (upperBounds.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user