Using default renderer in LoadBuiltinsTest.

This commit is contained in:
Evgeny Gerashchenko
2013-12-19 03:36:46 +04:00
parent ec5d41a10e
commit 1d21ebf882
4 changed files with 168 additions and 202 deletions
@@ -35,8 +35,6 @@ public class DescriptorRendererBuilder {
private boolean unitReturnType = true;
private boolean normalizedVisibilities = false;
private boolean showInternalKeyword = true;
private boolean alwaysRenderAny = false;
private boolean prettyFunctionTypes = true;
@NotNull
private DescriptorRenderer.OverrideRenderingPolicy overrideRenderingPolicy = DescriptorRenderer.OverrideRenderingPolicy.RENDER_OPEN;
@NotNull
@@ -123,19 +121,9 @@ public class DescriptorRendererBuilder {
return this;
}
public DescriptorRendererBuilder setAlwaysRenderAny(boolean alwaysRenderAny) {
this.alwaysRenderAny = alwaysRenderAny;
return this;
}
public DescriptorRendererBuilder setPrettyFunctionTypes(boolean prettyFunctionTypes) {
this.prettyFunctionTypes = prettyFunctionTypes;
return this;
}
public DescriptorRenderer build() {
return new DescriptorRendererImpl(shortNames, withDefinedIn, modifiers, startFromName, debugMode, classWithPrimaryConstructor,
verbose, unitReturnType, normalizedVisibilities, showInternalKeyword, alwaysRenderAny, prettyFunctionTypes,
verbose, unitReturnType, normalizedVisibilities, showInternalKeyword,
overrideRenderingPolicy, valueParametersHandler, textFormat, excludedAnnotationClasses);
}
@@ -48,8 +48,6 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
private final boolean unitReturnType;
private final boolean normalizedVisibilities;
private final boolean showInternalKeyword;
private final boolean alwaysRenderAny;
private final boolean prettyFunctionTypes;
@NotNull
private final OverrideRenderingPolicy overrideRenderingPolicy;
@NotNull
@@ -70,8 +68,6 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
boolean unitReturnType,
boolean normalizedVisibilities,
boolean showInternalKeyword,
boolean alwaysRenderAny,
boolean prettyFunctionTypes,
@NotNull OverrideRenderingPolicy overrideRenderingPolicy,
@NotNull ValueParametersHandler handler,
@NotNull TextFormat textFormat,
@@ -91,8 +87,6 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
this.debugMode = debugMode;
this.textFormat = textFormat;
this.excludedAnnotationClasses = Sets.newHashSet(excludedAnnotationClasses);
this.alwaysRenderAny = alwaysRenderAny;
this.prettyFunctionTypes = prettyFunctionTypes;
}
@@ -214,7 +208,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
if (type.isError()) {
return type.toString();
}
if (KotlinBuiltIns.getInstance().isExactFunctionOrExtensionFunctionType(type) && prettyFunctionTypes) {
if (KotlinBuiltIns.getInstance().isExactFunctionOrExtensionFunctionType(type)) {
return renderFunctionType(type);
}
return renderDefaultType(type);
@@ -410,7 +404,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
int upperBoundsCount = typeParameter.getUpperBounds().size();
if ((upperBoundsCount > 1 && !topLevel) || upperBoundsCount == 1) {
JetType upperBound = typeParameter.getUpperBounds().iterator().next();
if (!KotlinBuiltIns.getInstance().getDefaultBound().equals(upperBound) || alwaysRenderAny) {
if (!KotlinBuiltIns.getInstance().getDefaultBound().equals(upperBound)) {
builder.append(" : ").append(renderType(upperBound));
}
}
@@ -640,7 +634,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
if (!klass.equals(KotlinBuiltIns.getInstance().getNothing())) {
Collection<JetType> supertypes = klass.getTypeConstructor().getSupertypes();
if (supertypes.isEmpty() || !alwaysRenderAny && supertypes.size() == 1 && KotlinBuiltIns.getInstance().isAnyOrNullableAny(
if (supertypes.isEmpty() || supertypes.size() == 1 && KotlinBuiltIns.getInstance().isAnyOrNullableAny(
supertypes.iterator().next())) {
}
else {