From 0a4ad3f267275af2de76f79f16a342a0f3157c3d Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Thu, 21 Apr 2016 20:35:37 +0300 Subject: [PATCH] Refactoring. Rename FlexibleTypeCapabilities -> FlexibleTypeFactory. Also use factory.create instead of DelegatingFlexibleType.create. --- .../kotlin/frontend/java/di/injection.kt | 6 ++-- ....kt => JavaFlexibleTypeFactoryProvider.kt} | 10 +++---- .../java/sam/SingleAbstractMethodUtils.java | 4 +-- .../jetbrains/kotlin/resolve/TypeResolver.kt | 14 ++++----- .../kotlin/types/CommonSupertypes.java | 12 ++++---- .../serialization/DescriptorSerializer.java | 4 +-- .../FlexibleTypeAssertionsEnabledTest.kt | 2 +- .../LazyJavaTypeParameterDescriptor.kt | 6 ++-- .../java/lazy/types/LazyJavaTypeResolver.kt | 15 ++++------ .../kotlin/load/java/lazy/types/RawType.kt | 4 +-- .../java/typeEnhancement/typeEnhancement.kt | 6 ++-- .../DeserializationComponentsForJava.kt | 4 +-- ...=> JavaFlexibleTypeFactoryDeserializer.kt} | 14 ++++----- .../builtInsPackageFragmentProvider.kt | 4 +-- .../kotlin/types/CapturedTypeApproximation.kt | 13 ++++---- .../kotlin/types/TypeSubstitutor.java | 6 ++-- .../jetbrains/kotlin/types/dynamicTypes.kt | 8 ++--- .../jetbrains/kotlin/types/flexibleTypes.kt | 30 ++++++++----------- ....kt => FlexibleTypeFactoryDeserializer.kt} | 20 ++++++------- .../deserialization/TypeDeserializer.kt | 14 ++++----- .../serialization/deserialization/context.kt | 4 +-- .../KotlinBuiltInDeserializerForDecompiler.kt | 4 +-- .../DeserializerForClassfileDecompiler.kt | 4 +-- ...tlinJavaScriptDeserializerForDecompiler.kt | 4 +-- .../stubBuilder/TypeClsStubBuilder.kt | 6 ++-- ...kotlinJavascriptPackageFragmentProvider.kt | 4 +-- .../res/syntheticDescriptorGeneration.kt | 9 ++++-- 27 files changed, 106 insertions(+), 125 deletions(-) rename compiler/frontend.java/src/org/jetbrains/kotlin/load/java/{JavaFlexibleTypeCapabilitiesProvider.kt => JavaFlexibleTypeFactoryProvider.kt} (63%) rename core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/{JavaFlexibleTypeCapabilitiesDeserializer.kt => JavaFlexibleTypeFactoryDeserializer.kt} (72%) rename core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/{FlexibleTypeCapabilitiesDeserializer.kt => FlexibleTypeFactoryDeserializer.kt} (54%) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/frontend/java/di/injection.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/frontend/java/di/injection.kt index 18132f8bd25..3b6f21297ba 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/frontend/java/di/injection.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/frontend/java/di/injection.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. @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.descriptors.PackagePartProvider import org.jetbrains.kotlin.frontend.di.configureModule import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.load.java.JavaClassFinderImpl -import org.jetbrains.kotlin.load.java.JavaFlexibleTypeCapabilitiesProvider +import org.jetbrains.kotlin.load.java.JavaFlexibleTypeFactoryProvider import org.jetbrains.kotlin.load.java.components.* import org.jetbrains.kotlin.load.java.lazy.ModuleClassResolver import org.jetbrains.kotlin.load.java.lazy.SingleModuleClassResolver @@ -62,7 +62,7 @@ fun StorageComponentContainer.configureJavaTopDownAnalysis(moduleContentScope: G useInstance(SamConversionResolverImpl) useImpl() useImpl() - useImpl() + useInstance(JavaFlexibleTypeFactoryProvider) } fun createContainerForLazyResolveWithJava( diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/JavaFlexibleTypeCapabilitiesProvider.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/JavaFlexibleTypeFactoryProvider.kt similarity index 63% rename from compiler/frontend.java/src/org/jetbrains/kotlin/load/java/JavaFlexibleTypeCapabilitiesProvider.kt rename to compiler/frontend.java/src/org/jetbrains/kotlin/load/java/JavaFlexibleTypeFactoryProvider.kt index d7022d8597e..a252b7ac5fb 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/JavaFlexibleTypeCapabilitiesProvider.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/JavaFlexibleTypeFactoryProvider.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. @@ -16,10 +16,10 @@ package org.jetbrains.kotlin.load.java -import org.jetbrains.kotlin.resolve.TypeResolver.FlexibleTypeCapabilitiesProvider -import org.jetbrains.kotlin.types.FlexibleTypeCapabilities import org.jetbrains.kotlin.load.java.lazy.types.LazyJavaTypeResolver +import org.jetbrains.kotlin.resolve.TypeResolver.FlexibleTypeFactoryProvider +import org.jetbrains.kotlin.types.FlexibleTypeFactory -class JavaFlexibleTypeCapabilitiesProvider : FlexibleTypeCapabilitiesProvider() { - override fun getCapabilities(): FlexibleTypeCapabilities = LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities +object JavaFlexibleTypeFactoryProvider : FlexibleTypeFactoryProvider() { + override val factory: FlexibleTypeFactory get() = LazyJavaTypeResolver.FlexibleJavaClassifierTypeFactory } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.java index 4faca479601..f7d474b730e 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/sam/SingleAbstractMethodUtils.java @@ -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 @@ public class SingleAbstractMethodUtils { "' should not end with conflict"; if (FlexibleTypesKt.isNullabilityFlexible(samType)) { - return LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities.create(type, TypeUtils.makeNullable(type)); + return LazyJavaTypeResolver.FlexibleJavaClassifierTypeFactory.INSTANCE.create(type, TypeUtils.makeNullable(type)); } return TypeUtils.makeNullableAsSpecified(type, samType.isMarkedNullable()); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt index 1991bbae037..378c94df63f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt @@ -50,7 +50,7 @@ class TypeResolver( private val annotationResolver: AnnotationResolver, private val qualifiedExpressionResolver: QualifiedExpressionResolver, private val moduleDescriptor: ModuleDescriptor, - private val flexibleTypeCapabilitiesProvider: FlexibleTypeCapabilitiesProvider, + private val flexibleTypeFactoryProvider: FlexibleTypeFactoryProvider, private val storageManager: StorageManager, private val lazinessToken: TypeLazinessToken, private val dynamicTypesSettings: DynamicTypesSettings, @@ -58,10 +58,8 @@ class TypeResolver( private val identifierChecker: IdentifierChecker ) { - open class FlexibleTypeCapabilitiesProvider { - open fun getCapabilities(): FlexibleTypeCapabilities { - return FlexibleTypeCapabilities.NONE - } + open class FlexibleTypeFactoryProvider { + open val factory: FlexibleTypeFactory get() = FlexibleTypeFactory.DEFAULT } fun resolveType(scope: LexicalScope, typeReference: KtTypeReference, trace: BindingTrace, checkBounds: Boolean): KotlinType { @@ -373,10 +371,8 @@ class TypeResolver( && parameters.size == 2) { // We create flexible types by convention here // This is not intended to be used in normal users' environments, only for tests and debugger etc - return type(DelegatingFlexibleType.create( - arguments[0].type, - arguments[1].type, - flexibleTypeCapabilitiesProvider.getCapabilities()) + return type(flexibleTypeFactoryProvider.factory.create(arguments[0].type, + arguments[1].type) ) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/CommonSupertypes.java b/compiler/frontend/src/org/jetbrains/kotlin/types/CommonSupertypes.java index 4cfd5b09d13..d2c6604eff6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/CommonSupertypes.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/CommonSupertypes.java @@ -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. @@ -25,7 +25,6 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor; import org.jetbrains.kotlin.descriptors.ClassifierDescriptor; import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor; import org.jetbrains.kotlin.descriptors.annotations.Annotations; -import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt; import org.jetbrains.kotlin.resolve.scopes.MemberScope; import org.jetbrains.kotlin.types.checker.KotlinTypeChecker; import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt; @@ -86,14 +85,14 @@ public class CommonSupertypes { boolean hasFlexible = false; List upper = new ArrayList(types.size()); List lower = new ArrayList(types.size()); - Set capabilities = new LinkedHashSet(); + Set factories = new LinkedHashSet(); for (KotlinType type : types) { if (FlexibleTypesKt.isFlexible(type)) { hasFlexible = true; Flexibility flexibility = FlexibleTypesKt.flexibility(type); upper.add(flexibility.getUpperBound()); lower.add(flexibility.getLowerBound()); - capabilities.add(flexibility.getExtraCapabilities()); + factories.add(flexibility.getFactory()); } else { upper.add(type); @@ -102,10 +101,9 @@ public class CommonSupertypes { } if (!hasFlexible) return commonSuperTypeForInflexible(types, recursionDepth, maxDepth); - return DelegatingFlexibleType.create( + return CollectionsKt.single(factories).create( // mixing different factories is not supported commonSuperTypeForInflexible(lower, recursionDepth, maxDepth), - commonSuperTypeForInflexible(upper, recursionDepth, maxDepth), - CollectionsKt.single(capabilities) // mixing different capabilities is not supported + commonSuperTypeForInflexible(upper, recursionDepth, maxDepth) ); } diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java index 89d8184b06a..2ab7115a1f2 100644 --- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java +++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java @@ -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. @@ -465,7 +465,7 @@ public class DescriptorSerializer { Flexibility flexibility = FlexibleTypesKt.flexibility(type); ProtoBuf.Type.Builder lowerBound = type(flexibility.getLowerBound()); - lowerBound.setFlexibleTypeCapabilitiesId(getStringTable().getStringIndex(flexibility.getExtraCapabilities().getId())); + lowerBound.setFlexibleTypeCapabilitiesId(getStringTable().getStringIndex(flexibility.getFactory().getId())); if (useTypeTable()) { lowerBound.setFlexibleUpperBoundId(typeId(flexibility.getUpperBound())); } diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/FlexibleTypeAssertionsEnabledTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/FlexibleTypeAssertionsEnabledTest.kt index 410c7c2ec2f..0268285f8b9 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/FlexibleTypeAssertionsEnabledTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/FlexibleTypeAssertionsEnabledTest.kt @@ -26,7 +26,7 @@ class FlexibleTypeAssertionsEnabledTest : KotlinTestWithEnvironmentManagement() val builtIns = JvmPlatform.builtIns try { - LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities.create( + LazyJavaTypeResolver.FlexibleJavaClassifierTypeFactory.create( builtIns.intType, builtIns.stringType).arguments } catch (e: AssertionError) { assertEquals("Lower bound Int of a flexible type must be a subtype of the upper bound String", e.message) 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 cc99ee25712..e0eb140bcc8 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 @@ -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. @@ -18,8 +18,6 @@ package org.jetbrains.kotlin.load.java.lazy.descriptors import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.SourceElement -import org.jetbrains.kotlin.descriptors.SupertypeLoopChecker -import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.descriptors.impl.AbstractLazyTypeParameterDescriptor import org.jetbrains.kotlin.load.java.components.TypeUsage import org.jetbrains.kotlin.load.java.lazy.LazyJavaAnnotations @@ -51,7 +49,7 @@ class LazyJavaTypeParameterDescriptor( override fun resolveUpperBounds(): List { val bounds = javaTypeParameter.upperBounds if (bounds.isEmpty()) { - return listOf(LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities.create( + return listOf(LazyJavaTypeResolver.FlexibleJavaClassifierTypeFactory.create( c.module.builtIns.anyType, c.module.builtIns.nullableAnyType )) 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 d359210220a..91014269ff2 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 @@ -57,7 +57,7 @@ class LazyJavaTypeResolver( } is JavaClassifierType -> if (attr.allowFlexible && attr.howThisTypeIsUsed != SUPERTYPE) - FlexibleJavaClassifierTypeCapabilities.create( + FlexibleJavaClassifierTypeFactory.create( LazyJavaClassifierType(javaType, attr.toFlexible(FLEXIBLE_LOWER_BOUND)), LazyJavaClassifierType(javaType, attr.toFlexible(FLEXIBLE_UPPER_BOUND)) ) @@ -76,7 +76,7 @@ class LazyJavaTypeResolver( if (primitiveType != null) { val jetType = c.module.builtIns.getPrimitiveArrayKotlinType(primitiveType) return@run if (attr.allowFlexible) - FlexibleJavaClassifierTypeCapabilities.create(jetType, TypeUtils.makeNullable(jetType)) + FlexibleJavaClassifierTypeFactory.create(jetType, TypeUtils.makeNullable(jetType)) else TypeUtils.makeNullableAsSpecified(jetType, !attr.isMarkedNotNull) } @@ -84,7 +84,7 @@ class LazyJavaTypeResolver( TYPE_ARGUMENT.toAttributes(attr.allowFlexible, attr.isForAnnotationParameter)) if (attr.allowFlexible) { - return@run FlexibleJavaClassifierTypeCapabilities.create( + return@run FlexibleJavaClassifierTypeFactory.create( c.module.builtIns.getArrayType(INVARIANT, componentType), TypeUtils.makeNullable(c.module.builtIns.getArrayType(OUT_VARIANCE, componentType))) } @@ -284,20 +284,17 @@ class LazyJavaTypeResolver( override fun getAnnotations() = annotations } - object FlexibleJavaClassifierTypeCapabilities : FlexibleTypeCapabilities { - @JvmStatic - fun create(lowerBound: KotlinType, upperBound: KotlinType) = DelegatingFlexibleType.create(lowerBound, upperBound, this) - + object FlexibleJavaClassifierTypeFactory : FlexibleTypeFactory { override val id: String get() = "kotlin.jvm.PlatformType" - override fun createFlexibleType(lowerBound: KotlinType, upperBound: KotlinType): KotlinType { + override fun create(lowerBound: KotlinType, upperBound: KotlinType): KotlinType { if (lowerBound == upperBound) return lowerBound return Impl(lowerBound, upperBound) } private class Impl(lowerBound: KotlinType, upperBound: KotlinType) : - DelegatingFlexibleType(lowerBound, upperBound, FlexibleJavaClassifierTypeCapabilities), CustomTypeVariable, Specificity { + DelegatingFlexibleType(lowerBound, upperBound, FlexibleJavaClassifierTypeFactory), CustomTypeVariable, Specificity { override fun getCapability(capabilityClass: Class): T? { @Suppress("UNCHECKED_CAST") diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/RawType.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/RawType.kt index 508e085ecc2..b206349dd08 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/RawType.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/types/RawType.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. @@ -97,7 +97,7 @@ internal object RawSubstitution : TypeSubstitution() { is ClassDescriptor -> { val lower = type.lowerIfFlexible() val upper = type.upperIfFlexible() - LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities.create( + LazyJavaTypeResolver.FlexibleJavaClassifierTypeFactory.create( eraseInflexibleBasedOnClassDescriptor(lower, declaration, lowerTypeAttr), eraseInflexibleBasedOnClassDescriptor(upper, declaration, upperTypeAttr) ) 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 f48c274099b..9ae85f65125 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 @@ -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. @@ -70,7 +70,7 @@ private fun KotlinType.enhancePossiblyFlexible(qualifiers: (Int) -> JavaTypeQual val wereChanges = lowerResult.wereChanges || upperResult.wereChanges Result( if (wereChanges) - DelegatingFlexibleType.create(lowerResult.type, upperResult.type, extraCapabilities) + factory.create(lowerResult.type, upperResult.type) else this@enhancePossiblyFlexible, lowerResult.subtreeSize, @@ -229,7 +229,7 @@ internal object NotNullTypeParameterTypeCapability : CustomTypeVariable { if (replacement.isFlexible()) { with(replacement.flexibility()) { - return DelegatingFlexibleType.create(lowerBound.prepareReplacement(), upperBound.prepareReplacement(), extraCapabilities) + return factory.create(lowerBound.prepareReplacement(), upperBound.prepareReplacement()) } } diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/DeserializationComponentsForJava.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/DeserializationComponentsForJava.kt index c99decc0a13..bf0a438bbde 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/DeserializationComponentsForJava.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/DeserializationComponentsForJava.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. @@ -40,7 +40,7 @@ class DeserializationComponentsForJava( val localClassResolver = LocalClassResolverImpl() components = DeserializationComponents( storageManager, moduleDescriptor, classDataFinder, annotationAndConstantLoader, packageFragmentProvider, localClassResolver, - errorReporter, lookupTracker, JavaFlexibleTypeCapabilitiesDeserializer, ClassDescriptorFactory.EMPTY, + errorReporter, lookupTracker, JavaFlexibleTypeFactoryDeserializer, ClassDescriptorFactory.EMPTY, notFoundClasses, JavaTypeCapabilitiesLoader, additionalSupertypes = BuiltInClassesAreSerializableOnJvm(moduleDescriptor) ) diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JavaFlexibleTypeCapabilitiesDeserializer.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JavaFlexibleTypeFactoryDeserializer.kt similarity index 72% rename from core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JavaFlexibleTypeCapabilitiesDeserializer.kt rename to core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JavaFlexibleTypeFactoryDeserializer.kt index 4854f4c8e0c..c5f899baaed 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JavaFlexibleTypeCapabilitiesDeserializer.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JavaFlexibleTypeFactoryDeserializer.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. @@ -16,14 +16,14 @@ package org.jetbrains.kotlin.load.kotlin -import org.jetbrains.kotlin.serialization.deserialization.FlexibleTypeCapabilitiesDeserializer import org.jetbrains.kotlin.load.java.lazy.types.LazyJavaTypeResolver -import org.jetbrains.kotlin.types.FlexibleTypeCapabilities +import org.jetbrains.kotlin.serialization.deserialization.FlexibleTypeFactoryDeserializer +import org.jetbrains.kotlin.types.FlexibleTypeFactory -object JavaFlexibleTypeCapabilitiesDeserializer : FlexibleTypeCapabilitiesDeserializer { - override fun capabilitiesById(id: String): FlexibleTypeCapabilities? { - return if (id == LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities.id) - LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities +object JavaFlexibleTypeFactoryDeserializer : FlexibleTypeFactoryDeserializer { + override fun capabilitiesById(id: String): FlexibleTypeFactory? { + return if (id == LazyJavaTypeResolver.FlexibleJavaClassifierTypeFactory.id) + LazyJavaTypeResolver.FlexibleJavaClassifierTypeFactory else null } diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/builtInsPackageFragmentProvider.kt b/core/descriptors/src/org/jetbrains/kotlin/builtins/builtInsPackageFragmentProvider.kt index 4783b8910a4..9d45ede95ff 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/builtInsPackageFragmentProvider.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/builtInsPackageFragmentProvider.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. @@ -50,7 +50,7 @@ fun createBuiltInPackageFragmentProvider( localClassResolver, ErrorReporter.DO_NOTHING, LookupTracker.DO_NOTHING, - FlexibleTypeCapabilitiesDeserializer.ThrowException, + FlexibleTypeFactoryDeserializer.ThrowException, classDescriptorFactory, notFoundClasses, additionalSupertypes = additionalSupertypes diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt b/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt index 1f236bd08cd..4ee600d8cb6 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.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. @@ -23,8 +23,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.isCaptured import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.checker.KotlinTypeChecker -import org.jetbrains.kotlin.types.typeUtil.* -import org.jetbrains.kotlin.utils.addToStdlib.check +import org.jetbrains.kotlin.types.typeUtil.builtIns import java.util.* data class ApproximationBounds( @@ -98,12 +97,10 @@ fun approximateCapturedTypes(type: KotlinType): ApproximationBounds val boundsForFlexibleLower = approximateCapturedTypes(type.lowerIfFlexible()) val boundsForFlexibleUpper = approximateCapturedTypes(type.upperIfFlexible()) - val extraCapabilities = type.flexibility().extraCapabilities + val factory = type.flexibility().factory return ApproximationBounds( - DelegatingFlexibleType.create( - boundsForFlexibleLower.lower.lowerIfFlexible(), boundsForFlexibleUpper.lower.upperIfFlexible(), extraCapabilities), - DelegatingFlexibleType.create( - boundsForFlexibleLower.upper.lowerIfFlexible(), boundsForFlexibleUpper.upper.upperIfFlexible(), extraCapabilities)) + factory.create(boundsForFlexibleLower.lower.lowerIfFlexible(), boundsForFlexibleUpper.lower.upperIfFlexible()), + factory.create(boundsForFlexibleLower.upper.lowerIfFlexible(), boundsForFlexibleUpper.upper.upperIfFlexible())) } val typeConstructor = type.constructor diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitutor.java b/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitutor.java index 6f601e32466..68f3cdf4489 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitutor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitutor.java @@ -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. @@ -146,8 +146,8 @@ public class TypeSubstitutor { originalProjectionKind == Variance.INVARIANT || originalProjectionKind == substitutedProjectionKind : "Unexpected substituted projection kind: " + substitutedProjectionKind + "; original: " + originalProjectionKind; - KotlinType substitutedFlexibleType = DelegatingFlexibleType.create( - substitutedLower.getType(), substitutedUpper.getType(), flexibility.getExtraCapabilities()); + KotlinType substitutedFlexibleType = flexibility.getFactory().create( + substitutedLower.getType(), substitutedUpper.getType()); return new TypeProjectionImpl(substitutedProjectionKind, substitutedFlexibleType); } diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/dynamicTypes.kt b/core/descriptors/src/org/jetbrains/kotlin/types/dynamicTypes.kt index 1b284efb223..d2cce6020c0 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/dynamicTypes.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/dynamicTypes.kt @@ -33,17 +33,17 @@ interface Dynamicity : TypeCapability fun KotlinType.isDynamic(): Boolean = this.getCapability(Dynamicity::class.java) != null -fun createDynamicType(builtIns: KotlinBuiltIns) = DynamicTypeCapabilities.createFlexibleType(builtIns.nothingType, builtIns.nullableAnyType) +fun createDynamicType(builtIns: KotlinBuiltIns) = DynamicTypeFactory.create(builtIns.nothingType, builtIns.nullableAnyType) -object DynamicTypeCapabilities : FlexibleTypeCapabilities { +object DynamicTypeFactory : FlexibleTypeFactory { override val id: String get() = "kotlin.DynamicType" - override fun createFlexibleType(lowerBound: KotlinType, upperBound: KotlinType): KotlinType { + override fun create(lowerBound: KotlinType, upperBound: KotlinType): KotlinType { if (lowerBound == upperBound) return lowerBound return Impl(lowerBound, upperBound) } - private class Impl(lowerBound: KotlinType, upperBound: KotlinType) : DelegatingFlexibleType(lowerBound, upperBound, DynamicTypeCapabilities), Dynamicity, Specificity, NullAwareness, FlexibleTypeDelegation { + private class Impl(lowerBound: KotlinType, upperBound: KotlinType) : DelegatingFlexibleType(lowerBound, upperBound, DynamicTypeFactory), Dynamicity, Specificity, NullAwareness, FlexibleTypeDelegation { companion object { internal val capabilityClasses = hashSetOf( Dynamicity::class.java, diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt b/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt index a6224245c5b..a36bbfcac1c 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/flexibleTypes.kt @@ -20,17 +20,18 @@ import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.types.checker.KotlinTypeChecker -interface FlexibleTypeCapabilities { - fun createFlexibleType(lowerBound: KotlinType, upperBound: KotlinType): KotlinType +interface FlexibleTypeFactory { val id: String - object NONE : FlexibleTypeCapabilities { - override fun createFlexibleType(lowerBound: KotlinType, upperBound: KotlinType): KotlinType { - if (lowerBound == upperBound) return lowerBound - return object : DelegatingFlexibleType(lowerBound, upperBound, this@NONE) {} - } + fun create(lowerBound: KotlinType, upperBound: KotlinType): KotlinType + object DEFAULT : FlexibleTypeFactory { override val id: String get() = "NONE" + + override fun create(lowerBound: KotlinType, upperBound: KotlinType): KotlinType { + if (lowerBound == upperBound) return lowerBound + return object : DelegatingFlexibleType(lowerBound, upperBound, this@DEFAULT) {} + } } } @@ -47,7 +48,7 @@ interface Flexibility : TypeCapability, SubtypingRepresentatives { val lowerBound: KotlinType val upperBound: KotlinType - val extraCapabilities: FlexibleTypeCapabilities + val factory: FlexibleTypeFactory override val subTypeRepresentative: KotlinType get() = lowerBound @@ -115,7 +116,7 @@ interface FlexibleTypeDelegation : TypeCapability { open class DelegatingFlexibleType protected constructor( override val lowerBound: KotlinType, override val upperBound: KotlinType, - override val extraCapabilities: FlexibleTypeCapabilities + override val factory: FlexibleTypeFactory ) : DelegatingType(), NullAwareness, Flexibility, FlexibleTypeDelegation { companion object { internal val capabilityClasses = hashSetOf( @@ -125,11 +126,6 @@ open class DelegatingFlexibleType protected constructor( FlexibleTypeDelegation::class.java ) - @JvmStatic - fun create(lowerBound: KotlinType, upperBound: KotlinType, extraCapabilities: FlexibleTypeCapabilities): KotlinType { - return extraCapabilities.createFlexibleType(lowerBound, upperBound) - } - @JvmField var RUN_SLOW_ASSERTIONS = false } @@ -162,10 +158,8 @@ open class DelegatingFlexibleType protected constructor( } override fun makeNullableAsSpecified(nullable: Boolean): KotlinType { - return create( - TypeUtils.makeNullableAsSpecified(lowerBound, nullable), - TypeUtils.makeNullableAsSpecified(upperBound, nullable), - extraCapabilities) + return factory.create(TypeUtils.makeNullableAsSpecified(lowerBound, nullable), + TypeUtils.makeNullableAsSpecified(upperBound, nullable)) } override fun computeIsNullable() = delegateType.isMarkedNullable diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/FlexibleTypeCapabilitiesDeserializer.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/FlexibleTypeFactoryDeserializer.kt similarity index 54% rename from core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/FlexibleTypeCapabilitiesDeserializer.kt rename to core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/FlexibleTypeFactoryDeserializer.kt index 69e0e9546be..cf716f781f7 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/FlexibleTypeCapabilitiesDeserializer.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/FlexibleTypeFactoryDeserializer.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. @@ -16,22 +16,22 @@ package org.jetbrains.kotlin.serialization.deserialization -import org.jetbrains.kotlin.types.DynamicTypeCapabilities -import org.jetbrains.kotlin.types.FlexibleTypeCapabilities +import org.jetbrains.kotlin.types.DynamicTypeFactory +import org.jetbrains.kotlin.types.FlexibleTypeFactory -interface FlexibleTypeCapabilitiesDeserializer { - object ThrowException : FlexibleTypeCapabilitiesDeserializer { - override fun capabilitiesById(id: String): FlexibleTypeCapabilities? { +interface FlexibleTypeFactoryDeserializer { + object ThrowException : FlexibleTypeFactoryDeserializer { + override fun capabilitiesById(id: String): FlexibleTypeFactory? { throw IllegalArgumentException("Capabilities not found by ThrowException manager: $id") } } - object Dynamic : FlexibleTypeCapabilitiesDeserializer { - override fun capabilitiesById(id: String): FlexibleTypeCapabilities? { - return if (id == DynamicTypeCapabilities.id) DynamicTypeCapabilities else null + object Dynamic : FlexibleTypeFactoryDeserializer { + override fun capabilitiesById(id: String): FlexibleTypeFactory? { + return if (id == DynamicTypeFactory.id) DynamicTypeFactory else null } } - fun capabilitiesById(id: String): FlexibleTypeCapabilities? + fun capabilitiesById(id: String): FlexibleTypeFactory? } diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/TypeDeserializer.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/TypeDeserializer.kt index 8020edc7be1..505fff402f6 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/TypeDeserializer.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/TypeDeserializer.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. @@ -56,14 +56,12 @@ class TypeDeserializer( fun type(proto: ProtoBuf.Type, additionalAnnotations: Annotations = Annotations.EMPTY): KotlinType { if (proto.hasFlexibleTypeCapabilitiesId()) { val id = c.nameResolver.getString(proto.flexibleTypeCapabilitiesId) - val capabilities = c.components.flexibleTypeCapabilitiesDeserializer.capabilitiesById(id) ?: - return ErrorUtils.createErrorType("${DeserializedType(c, proto)}: Capabilities not found for id $id") + val capabilities = c.components.flexibleTypeFactoryDeserializer.capabilitiesById(id) ?: + return ErrorUtils.createErrorType("${DeserializedType(c, proto)}: Capabilities not found for id $id") - return DelegatingFlexibleType.create( - DeserializedType(c, proto), - DeserializedType(c, proto.flexibleUpperBound(c.typeTable)!!), - capabilities - ) + return capabilities + .create(DeserializedType(c, proto), + DeserializedType(c, proto.flexibleUpperBound(c.typeTable)!!)) } return DeserializedType(c, proto, additionalAnnotations) diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/context.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/context.kt index 17743a33ceb..0fd1243f528 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/context.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/context.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. @@ -34,7 +34,7 @@ class DeserializationComponents( val localClassResolver: LocalClassResolver, val errorReporter: ErrorReporter, val lookupTracker: LookupTracker, - val flexibleTypeCapabilitiesDeserializer: FlexibleTypeCapabilitiesDeserializer, + val flexibleTypeFactoryDeserializer: FlexibleTypeFactoryDeserializer, val fictitiousClassDescriptorFactory: ClassDescriptorFactory, val notFoundClasses: NotFoundClasses, val typeCapabilitiesLoader: TypeCapabilitiesLoader = TypeCapabilitiesLoader.NONE, diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDeserializerForDecompiler.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDeserializerForDecompiler.kt index 72d1a483911..2f69e34de33 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDeserializerForDecompiler.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDeserializerForDecompiler.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. @@ -48,7 +48,7 @@ class KotlinBuiltInDeserializerForDecompiler( storageManager, moduleDescriptor, BuiltInsClassDataFinder(proto, nameResolver), AnnotationAndConstantLoaderImpl(moduleDescriptor, notFoundClasses, BuiltInSerializerProtocol), packageFragmentProvider, ResolveEverythingToKotlinAnyLocalClassResolver(targetPlatform.builtIns), LoggingErrorReporter(LOG), - LookupTracker.DO_NOTHING, FlexibleTypeCapabilitiesDeserializer.ThrowException, ClassDescriptorFactory.EMPTY, + LookupTracker.DO_NOTHING, FlexibleTypeFactoryDeserializer.ThrowException, ClassDescriptorFactory.EMPTY, notFoundClasses ) } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/classFile/DeserializerForClassfileDecompiler.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/classFile/DeserializerForClassfileDecompiler.kt index c2bd42ee5a7..e3a299b79ee 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/classFile/DeserializerForClassfileDecompiler.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/classFile/DeserializerForClassfileDecompiler.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. @@ -64,7 +64,7 @@ class DeserializerForClassfileDecompiler( deserializationComponents = DeserializationComponents( storageManager, moduleDescriptor, classDataFinder, annotationAndConstantLoader, packageFragmentProvider, ResolveEverythingToKotlinAnyLocalClassResolver(targetPlatform.builtIns), LoggingErrorReporter(LOG), - LookupTracker.DO_NOTHING, JavaFlexibleTypeCapabilitiesDeserializer, ClassDescriptorFactory.EMPTY, notFoundClasses + LookupTracker.DO_NOTHING, JavaFlexibleTypeFactoryDeserializer, ClassDescriptorFactory.EMPTY, notFoundClasses ) } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/js/KotlinJavaScriptDeserializerForDecompiler.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/js/KotlinJavaScriptDeserializerForDecompiler.kt index 891c6252380..7f68b48bb1a 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/js/KotlinJavaScriptDeserializerForDecompiler.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/js/KotlinJavaScriptDeserializerForDecompiler.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. @@ -61,7 +61,7 @@ class KotlinJavaScriptDeserializerForDecompiler( deserializationComponents = DeserializationComponents( storageManager, moduleDescriptor, classDataFinder, annotationAndConstantLoader, packageFragmentProvider, ResolveEverythingToKotlinAnyLocalClassResolver(targetPlatform.builtIns), LoggingErrorReporter(LOG), - LookupTracker.DO_NOTHING, FlexibleTypeCapabilitiesDeserializer.Dynamic, ClassDescriptorFactory.EMPTY, + LookupTracker.DO_NOTHING, FlexibleTypeFactoryDeserializer.Dynamic, ClassDescriptorFactory.EMPTY, notFoundClasses ) } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt index 1b1a9883c85..338f510b06b 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.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. @@ -37,7 +37,7 @@ import org.jetbrains.kotlin.serialization.ProtoBuf.Type import org.jetbrains.kotlin.serialization.ProtoBuf.Type.Argument.Projection import org.jetbrains.kotlin.serialization.ProtoBuf.TypeParameter.Variance import org.jetbrains.kotlin.serialization.deserialization.* -import org.jetbrains.kotlin.types.DynamicTypeCapabilities +import org.jetbrains.kotlin.types.DynamicTypeFactory import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList import java.util.* @@ -71,7 +71,7 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) { if (type.hasFlexibleTypeCapabilitiesId()) { val id = c.nameResolver.getString(type.flexibleTypeCapabilitiesId) - if (id == DynamicTypeCapabilities.id) { + if (id == DynamicTypeFactory.id) { KotlinPlaceHolderStubImpl(parent, KtStubElementTypes.DYNAMIC_TYPE) return } diff --git a/js/js.serializer/src/org/jetbrains/kotlin/serialization/js/kotlinJavascriptPackageFragmentProvider.kt b/js/js.serializer/src/org/jetbrains/kotlin/serialization/js/kotlinJavascriptPackageFragmentProvider.kt index 6e8fda24842..d5028a948fb 100644 --- a/js/js.serializer/src/org/jetbrains/kotlin/serialization/js/kotlinJavascriptPackageFragmentProvider.kt +++ b/js/js.serializer/src/org/jetbrains/kotlin/serialization/js/kotlinJavascriptPackageFragmentProvider.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. @@ -48,7 +48,7 @@ fun createKotlinJavascriptPackageFragmentProvider( localClassResolver, ErrorReporter.DO_NOTHING, LookupTracker.DO_NOTHING, - FlexibleTypeCapabilitiesDeserializer.Dynamic, + FlexibleTypeFactoryDeserializer.Dynamic, ClassDescriptorFactory.EMPTY, notFoundClasses ) diff --git a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/res/syntheticDescriptorGeneration.kt b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/res/syntheticDescriptorGeneration.kt index bba34927bf4..2e6876e224c 100644 --- a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/res/syntheticDescriptorGeneration.kt +++ b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/res/syntheticDescriptorGeneration.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. @@ -29,7 +29,10 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe import org.jetbrains.kotlin.resolve.source.PsiSourceElement -import org.jetbrains.kotlin.types.* +import org.jetbrains.kotlin.types.FlexibleTypeFactory +import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.KotlinTypeImpl +import org.jetbrains.kotlin.types.StarProjectionImpl import org.jetbrains.kotlin.types.typeUtil.makeNullable private class XmlSourceElement(override val psi: PsiElement) : PsiSourceElement @@ -106,7 +109,7 @@ private fun genProperty( override val resourceId = id } - val flexibleType = DelegatingFlexibleType.create(type, type.makeNullable(), FlexibleTypeCapabilities.NONE) + val flexibleType = FlexibleTypeFactory.DEFAULT.create(type, type.makeNullable()) property.setType( flexibleType, emptyList(),