From 3fd757e097e60ea3ca9cdd3d458d72cfedbe7fd7 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Sat, 16 Jun 2012 00:22:23 +0400 Subject: [PATCH] ClassDescriptor.getConstructor returns Collection --- .../org/jetbrains/jet/lang/descriptors/ClassDescriptor.java | 3 ++- .../jetbrains/jet/lang/descriptors/ClassDescriptorImpl.java | 2 +- .../jet/lang/descriptors/LazySubstitutingClassDescriptor.java | 4 ++-- .../jet/lang/descriptors/MutableClassDescriptorLite.java | 2 +- .../org/jetbrains/jet/lang/resolve/calls/CallResolver.java | 4 ++-- .../jetbrains/jet/lang/resolve/lazy/LazyClassDescriptor.java | 2 +- .../frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java index ec031a07273..a87e075ec22 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/ClassDescriptor.java @@ -24,6 +24,7 @@ import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.TypeProjection; import org.jetbrains.jet.lang.types.TypeSubstitutor; +import java.util.Collection; import java.util.List; import java.util.Set; @@ -39,7 +40,7 @@ public interface ClassDescriptor extends ClassifierDescriptor, MemberDescriptor, JetScope getUnsubstitutedInnerClassesScope(); @NotNull - Set getConstructors(); + Collection getConstructors(); @Override @NotNull diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/ClassDescriptorImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/ClassDescriptorImpl.java index e36d672400e..23bf950930e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/ClassDescriptorImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/ClassDescriptorImpl.java @@ -111,7 +111,7 @@ public class ClassDescriptorImpl extends DeclarationDescriptorImpl implements Cl @NotNull @Override - public Set getConstructors() { + public Collection getConstructors() { return constructors; } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/LazySubstitutingClassDescriptor.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/LazySubstitutingClassDescriptor.java index 338301d8cae..c35913a6197 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/LazySubstitutingClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/LazySubstitutingClassDescriptor.java @@ -113,8 +113,8 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor { @NotNull @Override - public Set getConstructors() { - Set r = Sets.newHashSet(); + public Collection getConstructors() { + Collection r = Lists.newArrayList(); for (ConstructorDescriptor constructor : original.getConstructors()) { r.add((ConstructorDescriptor) constructor.substitute(getSubstitutor())); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java index bb6cb468e3e..8531b28df04 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java @@ -147,7 +147,7 @@ public class MutableClassDescriptorLite extends ClassDescriptorBase @NotNull @Override - public Set getConstructors() { + public Collection getConstructors() { return constructors; } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java index 26294ca844a..5df72656388 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java @@ -188,7 +188,7 @@ public class CallResolver { DeclarationDescriptor declarationDescriptor = constructedType.getConstructor().getDeclarationDescriptor(); if (declarationDescriptor instanceof ClassDescriptor) { ClassDescriptor classDescriptor = (ClassDescriptor) declarationDescriptor; - Set constructors = classDescriptor.getConstructors(); + Collection constructors = classDescriptor.getConstructors(); if (constructors.isEmpty()) { context.trace.report(NO_CONSTRUCTOR.on(reportAbsenceOn)); return checkArgumentTypesAndFail(context); @@ -213,7 +213,7 @@ public class CallResolver { assert containingDeclaration instanceof ClassDescriptor; ClassDescriptor classDescriptor = (ClassDescriptor) containingDeclaration; - Set constructors = classDescriptor.getConstructors(); + Collection constructors = classDescriptor.getConstructors(); if (constructors.isEmpty()) { context.trace.report(NO_CONSTRUCTOR.on(reportAbsenceOn)); return checkArgumentTypesAndFail(context); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/LazyClassDescriptor.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/LazyClassDescriptor.java index f796d97ff76..f718143ed4f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/LazyClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/LazyClassDescriptor.java @@ -136,7 +136,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes @NotNull @Override - public Set getConstructors() { + public Collection getConstructors() { return unsubstitutedMemberScope.getConstructors(); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java index 5f24e97621f..27703d7c531 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/ErrorUtils.java @@ -121,7 +121,7 @@ public class ErrorUtils { private static final ClassDescriptorImpl ERROR_CLASS = new ClassDescriptorImpl(ERROR_MODULE, Collections.emptyList(), Name.special("")) { @NotNull @Override - public Set getConstructors() { + public Collection getConstructors() { return ERROR_CONSTRUCTOR_GROUP; }