allow null from CallableDescriptor.getReturnType

This commit is contained in:
Stepan Koltsov
2011-11-24 23:13:03 +04:00
parent aba6b3d6b9
commit 9ef4790976
6 changed files with 8 additions and 7 deletions
@@ -21,7 +21,9 @@ public interface CallableDescriptor extends DeclarationDescriptor {
@NotNull
List<TypeParameterDescriptor> getTypeParameters();
@NotNull
/**
* Method may return null for not yet fully initialized object or if error occurred.
*/
JetType getReturnType();
@NotNull
@@ -120,7 +120,6 @@ public class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements
}
@Override
@NotNull
public JetType getReturnType() {
return unsubstitutedReturnType;
}
@@ -113,7 +113,6 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
return expectedThisObject;
}
@NotNull
@Override
public JetType getReturnType() {
return getOutType();
@@ -34,7 +34,6 @@ public class PropertyGetterDescriptor extends PropertyAccessorDescriptor {
return Collections.emptyList();
}
@NotNull
@Override
public JetType getReturnType() {
return returnType;
@@ -84,7 +84,6 @@ public abstract class VariableDescriptorImpl extends DeclarationDescriptorImpl i
return ReceiverDescriptor.NO_RECEIVER;
}
@NotNull
@Override
public JetType getReturnType() {
return getOutType();
@@ -73,7 +73,11 @@ public class DescriptorRenderer implements Renderer {
}
public String renderType(JetType type) {
return escape(type.toString());
if (type != null) {
return escape("<?>");
} else {
return escape(type.toString());
}
}
protected String escape(String s) {
@@ -222,7 +226,6 @@ public class DescriptorRenderer implements Renderer {
renderName(descriptor, builder);
renderValueParameters(descriptor, builder);
// TODO: getReturnType may be uninitialized and throw IllegalStateException // stepan.koltsov@ 2011-11-21
builder.append(" : ").append(escape(renderType(descriptor.getReturnType())));
return super.visitFunctionDescriptor(descriptor, builder);
}