Minor. Merge TypeUsage::MEMBER_SIGNATURE_INVARIANT and COMMON

Their usages are effectively the same
This commit is contained in:
Denis Zharkov
2017-06-06 16:17:56 +03:00
parent 69e70575f9
commit 5ca3459a0f
5 changed files with 5 additions and 6 deletions
@@ -23,7 +23,6 @@ package org.jetbrains.kotlin.load.java.components;
public enum TypeUsage {
MEMBER_SIGNATURE_COVARIANT,
MEMBER_SIGNATURE_CONTRAVARIANT,
MEMBER_SIGNATURE_INVARIANT,
SUPERTYPE,
COMMON
}
@@ -132,7 +132,7 @@ class LazyJavaAnnotationDescriptor(
// Class type is never nullable in 'Foo.class' in Java
val type = TypeUtils.makeNotNullable(c.typeResolver.transformJavaType(
javaType,
TypeUsage.MEMBER_SIGNATURE_INVARIANT.toAttributes(allowFlexible = false))
TypeUsage.COMMON.toAttributes(allowFlexible = false))
)
val jlClass = c.module.resolveTopLevelClass(FqName("java.lang.Class"), NoLookupLocation.FOR_NON_TRACKED_SCOPE) ?: return null
@@ -561,7 +561,7 @@ class LazyJavaClassMemberScope(
val methods = jClass.methods
val result = ArrayList<ValueParameterDescriptor>(methods.size)
val attr = TypeUsage.MEMBER_SIGNATURE_INVARIANT.toAttributes(allowFlexible = false, isForAnnotationParameter = true)
val attr = TypeUsage.COMMON.toAttributes(allowFlexible = false, isForAnnotationParameter = true)
val (methodsNamedValue, otherMethods) = methods.
partition { it.name == JvmAnnotationNames.DEFAULT_ANNOTATION_MEMBER_NAME }
@@ -286,7 +286,7 @@ abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) : MemberS
val allowFlexible = !(field.isFinalStatic && field.hasConstantNotNullInitializer)
val propertyType = c.typeResolver.transformJavaType(
field.type,
LazyJavaTypeAttributes(TypeUsage.MEMBER_SIGNATURE_INVARIANT, annotations, allowFlexible)
LazyJavaTypeAttributes(TypeUsage.COMMON, annotations, allowFlexible)
)
if (!allowFlexible) {
return TypeUtils.makeNotNullable(propertyType)
@@ -85,9 +85,9 @@ class RawTypeImpl(lowerBound: SimpleType, upperBound: SimpleType) : FlexibleType
internal object RawSubstitution : TypeSubstitution() {
override fun get(key: KotlinType) = TypeProjectionImpl(eraseType(key))
private val lowerTypeAttr = TypeUsage.MEMBER_SIGNATURE_INVARIANT.toAttributes()
private val lowerTypeAttr = TypeUsage.COMMON.toAttributes()
.computeAttributes(allowFlexible = false, isRaw = true, forLower = true)
private val upperTypeAttr = TypeUsage.MEMBER_SIGNATURE_INVARIANT.toAttributes()
private val upperTypeAttr = TypeUsage.COMMON.toAttributes()
.computeAttributes(allowFlexible = false, isRaw = true, forLower = false)
fun eraseType(type: KotlinType): KotlinType {