Make constructor of JetTypeImpl private, introduce factory methods

This commit is contained in:
Denis Zharkov
2015-08-03 17:55:00 +03:00
parent 101ab03721
commit 460c719753
29 changed files with 90 additions and 65 deletions
@@ -168,10 +168,9 @@ class LazyJavaClassDescriptor(
parameter -> TypeProjectionImpl(Variance.INVARIANT, parameter.getDefaultType())
}
return JetTypeImpl(
Annotations.EMPTY, classDescriptor.getTypeConstructor(),
/* nullable =*/ false, parametersAsTypeProjections,
classDescriptor.getMemberScope(parametersAsTypeProjections)
return JetTypeImpl.create(
Annotations.EMPTY, classDescriptor,
/* nullable =*/ false, parametersAsTypeProjections
)
}
@@ -289,14 +289,14 @@ class LazyJavaTypeResolver(
val arguments = listOf(
TypeProjectionImpl(componentTypeProjection.projectionKind, eraseType(componentTypeProjection.type))
)
return JetTypeImpl(
return JetTypeImpl.create(
type.annotations, type.constructor, type.isMarkedNullable, arguments,
(type.constructor.declarationDescriptor as ClassDescriptor).getMemberScope(arguments)
)
}
val constructor = type.constructor
return JetTypeImpl(
return JetTypeImpl.create(
type.annotations, constructor, type.isMarkedNullable,
type.constructor.parameters.map {
parameter -> computeProjection(parameter, attr)
@@ -102,7 +102,7 @@ private fun JetType.enhanceInflexible(qualifiers: (Int) -> JavaTypeQualifiers, i
typeConstructor.parameters, enhancedArguments
)
val enhancedType = JetTypeImpl(
val enhancedType = JetTypeImpl.create(
newAnnotations,
typeConstructor,
enhancedNullability,