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
@@ -76,7 +76,7 @@ public class SingleAbstractMethodUtils {
}
ClassifierDescriptor classifier = functionType.getConstructor().getDeclarationDescriptor();
assert classifier instanceof ClassDescriptor : "Not class: " + classifier;
return new JetTypeImpl(
return JetTypeImpl.create(
functionType.getAnnotations(),
functionType.getConstructor(),
functionType.isMarkedNullable(),
@@ -61,7 +61,7 @@ class PropagationHeuristics {
if (JetTypeChecker.DEFAULT.isSubtypeOf(elementType, elementTypeInSuper)
&& !JetTypeChecker.DEFAULT.equalTypes(elementType, elementTypeInSuper)) {
JetTypeImpl betterTypeInSuper = new JetTypeImpl(
JetTypeImpl betterTypeInSuper = JetTypeImpl.create(
arrayTypeFromSuper.getAnnotations(),
arrayTypeFromSuper.getConstructor(),
arrayTypeFromSuper.isMarkedNullable(),
@@ -407,7 +407,7 @@ public class SignaturesPropagationData {
resultScope = autoType.getMemberScope();
}
JetTypeImpl type = new JetTypeImpl(autoType.getAnnotations(),
JetType type = JetTypeImpl.create(autoType.getAnnotations(),
resultClassifier.getTypeConstructor(),
resultNullable,
resultArguments,
@@ -157,8 +157,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
throw new AssertionError("Unexpected class of type constructor classifier "
+ (typeConstructorClassifier == null ? "null" : typeConstructorClassifier.getClass().getName()));
}
return new JetTypeImpl(originalType.getAnnotations(), typeConstructor, false,
altArguments, memberScope);
return JetTypeImpl.create(originalType.getAnnotations(), typeConstructor, false, altArguments, memberScope);
}
@NotNull