Minor. Merge TypeUsage::MEMBER_SIGNATURE_INVARIANT and COMMON
Their usages are effectively the same
This commit is contained in:
-1
@@ -23,7 +23,6 @@ package org.jetbrains.kotlin.load.java.components;
|
|||||||
public enum TypeUsage {
|
public enum TypeUsage {
|
||||||
MEMBER_SIGNATURE_COVARIANT,
|
MEMBER_SIGNATURE_COVARIANT,
|
||||||
MEMBER_SIGNATURE_CONTRAVARIANT,
|
MEMBER_SIGNATURE_CONTRAVARIANT,
|
||||||
MEMBER_SIGNATURE_INVARIANT,
|
|
||||||
SUPERTYPE,
|
SUPERTYPE,
|
||||||
COMMON
|
COMMON
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -132,7 +132,7 @@ class LazyJavaAnnotationDescriptor(
|
|||||||
// Class type is never nullable in 'Foo.class' in Java
|
// Class type is never nullable in 'Foo.class' in Java
|
||||||
val type = TypeUtils.makeNotNullable(c.typeResolver.transformJavaType(
|
val type = TypeUtils.makeNotNullable(c.typeResolver.transformJavaType(
|
||||||
javaType,
|
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
|
val jlClass = c.module.resolveTopLevelClass(FqName("java.lang.Class"), NoLookupLocation.FOR_NON_TRACKED_SCOPE) ?: return null
|
||||||
|
|||||||
+1
-1
@@ -561,7 +561,7 @@ class LazyJavaClassMemberScope(
|
|||||||
val methods = jClass.methods
|
val methods = jClass.methods
|
||||||
val result = ArrayList<ValueParameterDescriptor>(methods.size)
|
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.
|
val (methodsNamedValue, otherMethods) = methods.
|
||||||
partition { it.name == JvmAnnotationNames.DEFAULT_ANNOTATION_MEMBER_NAME }
|
partition { it.name == JvmAnnotationNames.DEFAULT_ANNOTATION_MEMBER_NAME }
|
||||||
|
|||||||
+1
-1
@@ -286,7 +286,7 @@ abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) : MemberS
|
|||||||
val allowFlexible = !(field.isFinalStatic && field.hasConstantNotNullInitializer)
|
val allowFlexible = !(field.isFinalStatic && field.hasConstantNotNullInitializer)
|
||||||
val propertyType = c.typeResolver.transformJavaType(
|
val propertyType = c.typeResolver.transformJavaType(
|
||||||
field.type,
|
field.type,
|
||||||
LazyJavaTypeAttributes(TypeUsage.MEMBER_SIGNATURE_INVARIANT, annotations, allowFlexible)
|
LazyJavaTypeAttributes(TypeUsage.COMMON, annotations, allowFlexible)
|
||||||
)
|
)
|
||||||
if (!allowFlexible) {
|
if (!allowFlexible) {
|
||||||
return TypeUtils.makeNotNullable(propertyType)
|
return TypeUtils.makeNotNullable(propertyType)
|
||||||
|
|||||||
+2
-2
@@ -85,9 +85,9 @@ class RawTypeImpl(lowerBound: SimpleType, upperBound: SimpleType) : FlexibleType
|
|||||||
internal object RawSubstitution : TypeSubstitution() {
|
internal object RawSubstitution : TypeSubstitution() {
|
||||||
override fun get(key: KotlinType) = TypeProjectionImpl(eraseType(key))
|
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)
|
.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)
|
.computeAttributes(allowFlexible = false, isRaw = true, forLower = false)
|
||||||
|
|
||||||
fun eraseType(type: KotlinType): KotlinType {
|
fun eraseType(type: KotlinType): KotlinType {
|
||||||
|
|||||||
Reference in New Issue
Block a user