Extract interface: TypeParameterDescriptor

A lot of code relied on these descriptors being mutable. In most cases I managed to work around this,
 but there're still are casts to raw List necessary in one or two places
This commit is contained in:
Andrey Breslav
2012-05-28 20:02:19 +04:00
parent 2165d5b765
commit e4007992c6
31 changed files with 357 additions and 293 deletions
@@ -223,7 +223,7 @@ public abstract class CodegenContext {
CallableMemberDescriptor.Kind.DECLARATION
);
JetType receiverType = pd.getReceiverParameter().exists() ? pd.getReceiverParameter().getType() : null;
myAccessor.setType(pd.getType(), Collections.<TypeParameterDescriptor>emptyList(), pd.getExpectedThisObject(), receiverType);
myAccessor.setType(pd.getType(), Collections.<TypeParameterDescriptorImpl>emptyList(), pd.getExpectedThisObject(), receiverType);
PropertyGetterDescriptor pgd = new PropertyGetterDescriptor(
myAccessor, Collections.<AnnotationDescriptor>emptyList(), myAccessor.getModality(),
@@ -54,7 +54,7 @@ public class CodegenUtil {
invokeDescriptor.initialize(fd.getReceiverParameter().exists() ? fd.getReceiverParameter().getType() : null,
fd.getExpectedThisObject(),
Collections.<TypeParameterDescriptor>emptyList(),
Collections.<TypeParameterDescriptorImpl>emptyList(),
fd.getValueParameters(),
fd.getReturnType(),
Modality.FINAL,
@@ -1093,7 +1093,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
}
}
if (descriptor instanceof TypeParameterDescriptor) {
if (descriptor instanceof TypeParameterDescriptorImpl) {
TypeParameterDescriptor typeParameterDescriptor = (TypeParameterDescriptor) descriptor;
v.invokevirtual("jet/TypeInfo", "getClassObject", "()Ljava/lang/Object;");
v.checkcast(asmType(typeParameterDescriptor.getClassObjectType()));
@@ -2614,7 +2614,7 @@ If finally block is present, its last expression is the value of try expression.
JetExpression left = expression.getLeft();
JetType leftType = bindingContext.get(BindingContext.EXPRESSION_TYPE, left);
DeclarationDescriptor descriptor = rightType.getConstructor().getDeclarationDescriptor();
if (descriptor instanceof ClassDescriptor || descriptor instanceof TypeParameterDescriptor) {
if (descriptor instanceof ClassDescriptor || descriptor instanceof TypeParameterDescriptorImpl) {
StackValue value = genQualified(receiver, left);
value.put(JetTypeMapper.boxType(value.type), v);
assert leftType != null;
@@ -463,7 +463,7 @@ public class JetTypeMapper {
return asmType;
}
if (descriptor instanceof TypeParameterDescriptor) {
if (descriptor instanceof TypeParameterDescriptorImpl) {
Type type = mapType(((TypeParameterDescriptor) descriptor).getUpperBoundsAsType(), kind);
if (signatureVisitor != null) {
@@ -722,7 +722,7 @@ public class JetTypeMapper {
signatureVisitor.writeInterfaceBoundEnd();
}
}
if (jetType.getConstructor().getDeclarationDescriptor() instanceof TypeParameterDescriptor) {
if (jetType.getConstructor().getDeclarationDescriptor() instanceof TypeParameterDescriptorImpl) {
signatureVisitor.writeInterfaceBound();
mapType(jetType, signatureVisitor, MapTypeMode.TYPE_PARAMETER);
signatureVisitor.writeInterfaceBoundEnd();
@@ -966,7 +966,7 @@ public class JetTypeMapper {
public boolean isGenericsArray(JetType type) {
DeclarationDescriptor declarationDescriptor = type.getConstructor().getDeclarationDescriptor();
if(declarationDescriptor instanceof TypeParameterDescriptor)
if(declarationDescriptor instanceof TypeParameterDescriptorImpl)
return true;
if(standardLibrary.getArray().equals(declarationDescriptor))