Remove dependency of "descriptors" on Lists
Also insert a sensible starting capacity almost everywhere
This commit is contained in:
+3
-2
@@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.descriptors.impl;
|
package org.jetbrains.jet.lang.descriptors.impl;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.PackageFragmentDescriptor;
|
import org.jetbrains.jet.lang.descriptors.PackageFragmentDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.PackageFragmentProvider;
|
import org.jetbrains.jet.lang.descriptors.PackageFragmentProvider;
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -38,10 +38,11 @@ public class CompositePackageFragmentProvider implements PackageFragmentProvider
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public List<PackageFragmentDescriptor> getPackageFragments(@NotNull FqName fqName) {
|
public List<PackageFragmentDescriptor> getPackageFragments(@NotNull FqName fqName) {
|
||||||
List<PackageFragmentDescriptor> result = Lists.newArrayList();
|
ArrayList<PackageFragmentDescriptor> result = new ArrayList<PackageFragmentDescriptor>();
|
||||||
for (PackageFragmentProvider provider : providers) {
|
for (PackageFragmentProvider provider : providers) {
|
||||||
result.addAll(provider.getPackageFragments(fqName));
|
result.addAll(provider.getPackageFragments(fqName));
|
||||||
}
|
}
|
||||||
|
result.trimToSize();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-5
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.descriptors.impl;
|
package org.jetbrains.jet.lang.descriptors.impl;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -69,8 +68,9 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
@NotNull List<ValueParameterDescriptor> unsubstitutedValueParameters,
|
@NotNull List<ValueParameterDescriptor> unsubstitutedValueParameters,
|
||||||
@Nullable JetType unsubstitutedReturnType,
|
@Nullable JetType unsubstitutedReturnType,
|
||||||
@Nullable Modality modality,
|
@Nullable Modality modality,
|
||||||
@NotNull Visibility visibility) {
|
@NotNull Visibility visibility
|
||||||
this.typeParameters = Lists.newArrayList(typeParameters);
|
) {
|
||||||
|
this.typeParameters = new ArrayList<TypeParameterDescriptor>(typeParameters);
|
||||||
this.unsubstitutedValueParameters = unsubstitutedValueParameters;
|
this.unsubstitutedValueParameters = unsubstitutedValueParameters;
|
||||||
this.unsubstitutedReturnType = unsubstitutedReturnType;
|
this.unsubstitutedReturnType = unsubstitutedReturnType;
|
||||||
this.modality = modality;
|
this.modality = modality;
|
||||||
@@ -202,8 +202,11 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
) {
|
) {
|
||||||
FunctionDescriptorImpl substitutedDescriptor = createSubstitutedCopy(newOwner, original, kind);
|
FunctionDescriptorImpl substitutedDescriptor = createSubstitutedCopy(newOwner, original, kind);
|
||||||
|
|
||||||
List<TypeParameterDescriptor> substitutedTypeParameters = Lists.newArrayList();
|
List<TypeParameterDescriptor> originalTypeParameters = getTypeParameters();
|
||||||
TypeSubstitutor substitutor = DescriptorSubstitutor.substituteTypeParameters(getTypeParameters(), originalSubstitutor, substitutedDescriptor, substitutedTypeParameters);
|
List<TypeParameterDescriptor> substitutedTypeParameters = new ArrayList<TypeParameterDescriptor>(originalTypeParameters.size());
|
||||||
|
TypeSubstitutor substitutor = DescriptorSubstitutor.substituteTypeParameters(
|
||||||
|
originalTypeParameters, originalSubstitutor, substitutedDescriptor, substitutedTypeParameters
|
||||||
|
);
|
||||||
|
|
||||||
JetType substitutedReceiverParameterType = null;
|
JetType substitutedReceiverParameterType = null;
|
||||||
if (receiverParameter != null) {
|
if (receiverParameter != null) {
|
||||||
|
|||||||
+14
-11
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.descriptors.impl;
|
package org.jetbrains.jet.lang.descriptors.impl;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
@@ -26,17 +25,16 @@ import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
|||||||
import org.jetbrains.jet.lang.resolve.scopes.SubstitutingScope;
|
import org.jetbrains.jet.lang.resolve.scopes.SubstitutingScope;
|
||||||
import org.jetbrains.jet.lang.types.*;
|
import org.jetbrains.jet.lang.types.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
||||||
|
|
||||||
private final ClassDescriptor original;
|
private final ClassDescriptor original;
|
||||||
private final TypeSubstitutor originalSubstitutor;
|
private final TypeSubstitutor originalSubstitutor;
|
||||||
private TypeSubstitutor newSubstitutor;
|
private TypeSubstitutor newSubstitutor;
|
||||||
private List<TypeParameterDescriptor> typeParameters;
|
private List<TypeParameterDescriptor> typeParameters;
|
||||||
private TypeConstructor typeConstructor;
|
private TypeConstructor typeConstructor;
|
||||||
private JetType superclassType;
|
|
||||||
|
|
||||||
public LazySubstitutingClassDescriptor(ClassDescriptor descriptor, TypeSubstitutor substitutor) {
|
public LazySubstitutingClassDescriptor(ClassDescriptor descriptor, TypeSubstitutor substitutor) {
|
||||||
this.original = descriptor;
|
this.original = descriptor;
|
||||||
@@ -49,8 +47,11 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
|||||||
newSubstitutor = originalSubstitutor;
|
newSubstitutor = originalSubstitutor;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
typeParameters = Lists.newArrayList();
|
List<TypeParameterDescriptor> originalTypeParameters = original.getTypeConstructor().getParameters();
|
||||||
newSubstitutor = DescriptorSubstitutor.substituteTypeParameters(original.getTypeConstructor().getParameters(), originalSubstitutor, this, typeParameters);
|
typeParameters = new ArrayList<TypeParameterDescriptor>(originalTypeParameters.size());
|
||||||
|
newSubstitutor = DescriptorSubstitutor.substituteTypeParameters(
|
||||||
|
originalTypeParameters, originalSubstitutor, this, typeParameters
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newSubstitutor;
|
return newSubstitutor;
|
||||||
@@ -67,8 +68,9 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
|||||||
if (typeConstructor == null) {
|
if (typeConstructor == null) {
|
||||||
TypeSubstitutor substitutor = getSubstitutor();
|
TypeSubstitutor substitutor = getSubstitutor();
|
||||||
|
|
||||||
Collection<JetType> supertypes = Lists.newArrayList();
|
Collection<JetType> originalSupertypes = originalTypeConstructor.getSupertypes();
|
||||||
for (JetType supertype : originalTypeConstructor.getSupertypes()) {
|
Collection<JetType> supertypes = new ArrayList<JetType>(originalSupertypes.size());
|
||||||
|
for (JetType supertype : originalSupertypes) {
|
||||||
supertypes.add(substitutor.substitute(supertype, Variance.INVARIANT));
|
supertypes.add(substitutor.substitute(supertype, Variance.INVARIANT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,11 +112,12 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<ConstructorDescriptor> getConstructors() {
|
public Collection<ConstructorDescriptor> getConstructors() {
|
||||||
Collection<ConstructorDescriptor> r = Lists.newArrayList();
|
Collection<ConstructorDescriptor> originalConstructors = original.getConstructors();
|
||||||
for (ConstructorDescriptor constructor : original.getConstructors()) {
|
Collection<ConstructorDescriptor> result = new ArrayList<ConstructorDescriptor>(originalConstructors.size());
|
||||||
r.add((ConstructorDescriptor) constructor.substitute(getSubstitutor()));
|
for (ConstructorDescriptor constructor : originalConstructors) {
|
||||||
|
result.add((ConstructorDescriptor) constructor.substitute(getSubstitutor()));
|
||||||
}
|
}
|
||||||
return r;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+2
-2
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.descriptors.impl;
|
package org.jetbrains.jet.lang.descriptors.impl;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
@@ -26,6 +25,7 @@ import org.jetbrains.jet.lang.resolve.scopes.ChainedScope;
|
|||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PackageViewDescriptorImpl extends DeclarationDescriptorImpl implements PackageViewDescriptor {
|
public class PackageViewDescriptorImpl extends DeclarationDescriptorImpl implements PackageViewDescriptor {
|
||||||
@@ -42,7 +42,7 @@ public class PackageViewDescriptorImpl extends DeclarationDescriptorImpl impleme
|
|||||||
this.module = module;
|
this.module = module;
|
||||||
this.fqName = fqName;
|
this.fqName = fqName;
|
||||||
|
|
||||||
List<JetScope> scopes = Lists.newArrayList();
|
List<JetScope> scopes = new ArrayList<JetScope>(fragments.size() + 1);
|
||||||
assert !fragments.isEmpty() : fqName + " in " + module;
|
assert !fragments.isEmpty() : fqName + " in " + module;
|
||||||
for (PackageFragmentDescriptor fragment : fragments) {
|
for (PackageFragmentDescriptor fragment : fragments) {
|
||||||
scopes.add(fragment.getMemberScope());
|
scopes.add(fragment.getMemberScope());
|
||||||
|
|||||||
+11
-8
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.descriptors.impl;
|
package org.jetbrains.jet.lang.descriptors.impl;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -31,6 +30,7 @@ import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
|||||||
import org.jetbrains.jet.lang.types.Variance;
|
import org.jetbrains.jet.lang.types.Variance;
|
||||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -102,7 +102,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
|||||||
) {
|
) {
|
||||||
setOutType(outType);
|
setOutType(outType);
|
||||||
|
|
||||||
this.typeParameters = Lists.newArrayList(typeParameters);
|
this.typeParameters = new ArrayList<TypeParameterDescriptor>(typeParameters);
|
||||||
|
|
||||||
this.receiverParameter = receiverParameter;
|
this.receiverParameter = receiverParameter;
|
||||||
this.expectedThisObject = expectedThisObject;
|
this.expectedThisObject = expectedThisObject;
|
||||||
@@ -182,14 +182,14 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
|||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<PropertyAccessorDescriptor> getAccessors() {
|
public List<PropertyAccessorDescriptor> getAccessors() {
|
||||||
List<PropertyAccessorDescriptor> r = Lists.newArrayListWithCapacity(2);
|
List<PropertyAccessorDescriptor> result = new ArrayList<PropertyAccessorDescriptor>(2);
|
||||||
if (getter != null) {
|
if (getter != null) {
|
||||||
r.add(getter);
|
result.add(getter);
|
||||||
}
|
}
|
||||||
if (setter != null) {
|
if (setter != null) {
|
||||||
r.add(setter);
|
result.add(setter);
|
||||||
}
|
}
|
||||||
return r;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -212,8 +212,11 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
|||||||
) {
|
) {
|
||||||
PropertyDescriptorImpl substitutedDescriptor = createSubstitutedCopy(newOwner, newModality, newVisibility, original, kind);
|
PropertyDescriptorImpl substitutedDescriptor = createSubstitutedCopy(newOwner, newModality, newVisibility, original, kind);
|
||||||
|
|
||||||
List<TypeParameterDescriptor> substitutedTypeParameters = Lists.newArrayList();
|
List<TypeParameterDescriptor> originalTypeParameters = getTypeParameters();
|
||||||
TypeSubstitutor substitutor = DescriptorSubstitutor.substituteTypeParameters(getTypeParameters(), originalSubstitutor, substitutedDescriptor, substitutedTypeParameters);
|
List<TypeParameterDescriptor> substitutedTypeParameters = new ArrayList<TypeParameterDescriptor>(originalTypeParameters.size());
|
||||||
|
TypeSubstitutor substitutor = DescriptorSubstitutor.substituteTypeParameters(
|
||||||
|
originalTypeParameters, originalSubstitutor, substitutedDescriptor, substitutedTypeParameters
|
||||||
|
);
|
||||||
|
|
||||||
JetType originalOutType = getType();
|
JetType originalOutType = getType();
|
||||||
JetType outType = substitutor.substitute(originalOutType, Variance.OUT_VARIANCE);
|
JetType outType = substitutor.substitute(originalOutType, Variance.OUT_VARIANCE);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.descriptors.impl;
|
package org.jetbrains.jet.lang.descriptors.impl;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.intellij.util.containers.ContainerUtil;
|
import com.intellij.util.containers.ContainerUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -27,6 +26,7 @@ import org.jetbrains.jet.lang.resolve.name.Name;
|
|||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScopeImpl;
|
import org.jetbrains.jet.lang.resolve.scopes.JetScopeImpl;
|
||||||
import org.jetbrains.jet.utils.Printer;
|
import org.jetbrains.jet.utils.Printer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -53,8 +53,9 @@ public class SubpackagesScope extends JetScopeImpl {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<DeclarationDescriptor> getAllDescriptors() {
|
public Collection<DeclarationDescriptor> getAllDescriptors() {
|
||||||
List<DeclarationDescriptor> result = Lists.newArrayList();
|
Collection<FqName> subFqNames = packageView.getModule().getPackageFragmentProvider().getSubPackagesOf(packageView.getFqName());
|
||||||
for (FqName subFqName : packageView.getModule().getPackageFragmentProvider().getSubPackagesOf(packageView.getFqName())) {
|
List<DeclarationDescriptor> result = new ArrayList<DeclarationDescriptor>(subFqNames.size());
|
||||||
|
for (FqName subFqName : subFqNames) {
|
||||||
ContainerUtil.addIfNotNull(result, getPackage(subFqName.shortName()));
|
ContainerUtil.addIfNotNull(result, getPackage(subFqName.shortName()));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve;
|
package org.jetbrains.jet.lang.resolve;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.intellij.util.containers.ContainerUtil;
|
import com.intellij.util.containers.ContainerUtil;
|
||||||
import kotlin.Function1;
|
import kotlin.Function1;
|
||||||
@@ -268,7 +267,7 @@ public class OverridingUtil {
|
|||||||
@NotNull ClassDescriptor current,
|
@NotNull ClassDescriptor current,
|
||||||
@NotNull DescriptorSink sink
|
@NotNull DescriptorSink sink
|
||||||
) {
|
) {
|
||||||
Collection<CallableMemberDescriptor> bound = Lists.newArrayList();
|
Collection<CallableMemberDescriptor> bound = new ArrayList<CallableMemberDescriptor>(descriptorsFromSuper.size());
|
||||||
for (CallableMemberDescriptor fromSupertype : descriptorsFromSuper) {
|
for (CallableMemberDescriptor fromSupertype : descriptorsFromSuper) {
|
||||||
OverrideCompatibilityInfo.Result result = DEFAULT.isOverridableBy(fromSupertype, fromCurrent).getResult();
|
OverrideCompatibilityInfo.Result result = DEFAULT.isOverridableBy(fromSupertype, fromCurrent).getResult();
|
||||||
|
|
||||||
@@ -392,7 +391,7 @@ public class OverridingUtil {
|
|||||||
@NotNull Queue<CallableMemberDescriptor> extractFrom,
|
@NotNull Queue<CallableMemberDescriptor> extractFrom,
|
||||||
@NotNull DescriptorSink sink
|
@NotNull DescriptorSink sink
|
||||||
) {
|
) {
|
||||||
Collection<CallableMemberDescriptor> overridable = Lists.newArrayList();
|
Collection<CallableMemberDescriptor> overridable = new ArrayList<CallableMemberDescriptor>();
|
||||||
overridable.add(overrider);
|
overridable.add(overrider);
|
||||||
for (Iterator<CallableMemberDescriptor> iterator = extractFrom.iterator(); iterator.hasNext(); ) {
|
for (Iterator<CallableMemberDescriptor> iterator = extractFrom.iterator(); iterator.hasNext(); ) {
|
||||||
CallableMemberDescriptor candidate = iterator.next();
|
CallableMemberDescriptor candidate = iterator.next();
|
||||||
|
|||||||
+2
-2
@@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve.calls.inference;
|
package org.jetbrains.jet.lang.resolve.calls.inference;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import kotlin.Function1;
|
import kotlin.Function1;
|
||||||
import kotlin.KotlinPackage;
|
import kotlin.KotlinPackage;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ public class ConstraintPosition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ConstraintPosition getCompoundConstraintPosition(ConstraintPosition... positions) {
|
public static ConstraintPosition getCompoundConstraintPosition(ConstraintPosition... positions) {
|
||||||
return new CompoundConstraintPosition(Lists.newArrayList(positions));
|
return new CompoundConstraintPosition(Arrays.asList(positions));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String debugName;
|
private final String debugName;
|
||||||
|
|||||||
+3
-4
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve.calls.inference;
|
package org.jetbrains.jet.lang.resolve.calls.inference;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import kotlin.Function1;
|
import kotlin.Function1;
|
||||||
@@ -31,7 +30,7 @@ import org.jetbrains.jet.lang.types.checker.TypingConstraints;
|
|||||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||||
import org.jetbrains.jet.utils.UtilsPackage;
|
import org.jetbrains.jet.utils.UtilsPackage;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -444,7 +443,7 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
|||||||
TypeBoundsImpl typeBounds = entry.getValue();
|
TypeBoundsImpl typeBounds = entry.getValue();
|
||||||
for (JetType declaredUpperBound : typeParameterDescriptor.getUpperBounds()) {
|
for (JetType declaredUpperBound : typeParameterDescriptor.getUpperBounds()) {
|
||||||
//todo order matters here
|
//todo order matters here
|
||||||
Collection<Bound> bounds = Lists.newArrayList(typeBounds.getBounds());
|
Collection<Bound> bounds = new ArrayList<Bound>(typeBounds.getBounds());
|
||||||
for (Bound bound : bounds) {
|
for (Bound bound : bounds) {
|
||||||
if (bound.kind == LOWER_BOUND || bound.kind == EXACT_BOUND) {
|
if (bound.kind == LOWER_BOUND || bound.kind == EXACT_BOUND) {
|
||||||
ConstraintPosition position = ConstraintPosition.getCompoundConstraintPosition(
|
ConstraintPosition position = ConstraintPosition.getCompoundConstraintPosition(
|
||||||
@@ -514,10 +513,10 @@ public class ConstraintSystemImpl implements ConstraintSystem {
|
|||||||
List<TypeProjection> typeArguments = functionType.getArguments();
|
List<TypeProjection> typeArguments = functionType.getArguments();
|
||||||
assert !typeArguments.isEmpty();
|
assert !typeArguments.isEmpty();
|
||||||
|
|
||||||
List<JetType> arguments = Lists.newArrayList();
|
|
||||||
// excluding the last type argument of the function type, which is the return type
|
// excluding the last type argument of the function type, which is the return type
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int lastIndex = typeArguments.size() - 1;
|
int lastIndex = typeArguments.size() - 1;
|
||||||
|
List<JetType> arguments = new ArrayList<JetType>(lastIndex);
|
||||||
for (TypeProjection typeArgument : typeArguments) {
|
for (TypeProjection typeArgument : typeArguments) {
|
||||||
if (index < lastIndex) {
|
if (index < lastIndex) {
|
||||||
arguments.add(typeArgument.getType());
|
arguments.add(typeArgument.getType());
|
||||||
|
|||||||
+3
-6
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve.calls.inference;
|
package org.jetbrains.jet.lang.resolve.calls.inference;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.intellij.util.containers.ContainerUtil;
|
import com.intellij.util.containers.ContainerUtil;
|
||||||
import kotlin.Function1;
|
import kotlin.Function1;
|
||||||
@@ -28,10 +27,7 @@ import org.jetbrains.jet.lang.resolve.constants.IntegerValueTypeConstructor;
|
|||||||
import org.jetbrains.jet.lang.types.*;
|
import org.jetbrains.jet.lang.types.*;
|
||||||
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
|
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.jetbrains.jet.lang.resolve.calls.inference.TypeBounds.BoundKind.LOWER_BOUND;
|
import static org.jetbrains.jet.lang.resolve.calls.inference.TypeBounds.BoundKind.LOWER_BOUND;
|
||||||
|
|
||||||
@@ -191,7 +187,8 @@ public class TypeBoundsImpl implements TypeBounds {
|
|||||||
|
|
||||||
if (superTypeOfLowerBounds != null && superTypeOfNumberLowerBounds != null) {
|
if (superTypeOfLowerBounds != null && superTypeOfNumberLowerBounds != null) {
|
||||||
JetType superTypeOfAllLowerBounds = CommonSupertypes.commonSupertypeForNonDenotableTypes(
|
JetType superTypeOfAllLowerBounds = CommonSupertypes.commonSupertypeForNonDenotableTypes(
|
||||||
Lists.newArrayList(superTypeOfLowerBounds, superTypeOfNumberLowerBounds));
|
Arrays.asList(superTypeOfLowerBounds, superTypeOfNumberLowerBounds)
|
||||||
|
);
|
||||||
if (tryPossibleAnswer(superTypeOfAllLowerBounds)) {
|
if (tryPossibleAnswer(superTypeOfAllLowerBounds)) {
|
||||||
return Collections.singleton(superTypeOfAllLowerBounds);
|
return Collections.singleton(superTypeOfAllLowerBounds);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve.constants;
|
package org.jetbrains.jet.lang.resolve.constants;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
|
||||||
@@ -26,13 +25,14 @@ import org.jetbrains.jet.lang.types.JetType;
|
|||||||
import org.jetbrains.jet.lang.types.TypeConstructor;
|
import org.jetbrains.jet.lang.types.TypeConstructor;
|
||||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class IntegerValueTypeConstructor implements TypeConstructor {
|
public class IntegerValueTypeConstructor implements TypeConstructor {
|
||||||
private final long value;
|
private final long value;
|
||||||
private final Collection<JetType> supertypes = Lists.newArrayList();
|
private final Collection<JetType> supertypes = new ArrayList<JetType>(4);
|
||||||
|
|
||||||
public IntegerValueTypeConstructor(long value) {
|
public IntegerValueTypeConstructor(long value) {
|
||||||
// order of types matters
|
// order of types matters
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve.name;
|
package org.jetbrains.jet.lang.resolve.name;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.utils.UtilsPackage;
|
import org.jetbrains.jet.utils.UtilsPackage;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class FqName extends FqNameBase {
|
public final class FqName extends FqNameBase {
|
||||||
@@ -116,7 +116,7 @@ public final class FqName extends FqNameBase {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<FqName> path() {
|
public List<FqName> path() {
|
||||||
final List<FqName> path = Lists.newArrayList();
|
final List<FqName> path = new ArrayList<FqName>();
|
||||||
path.add(ROOT);
|
path.add(ROOT);
|
||||||
fqName.walk(new FqNameUnsafe.WalkCallback() {
|
fqName.walk(new FqNameUnsafe.WalkCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,11 +16,11 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve.name;
|
package org.jetbrains.jet.lang.resolve.name;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.utils.UtilsPackage;
|
import org.jetbrains.jet.utils.UtilsPackage;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,7 +170,7 @@ public final class FqNameUnsafe extends FqNameBase {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<FqNameUnsafe> path() {
|
public List<FqNameUnsafe> path() {
|
||||||
final List<FqNameUnsafe> path = Lists.newArrayList();
|
final List<FqNameUnsafe> path = new ArrayList<FqNameUnsafe>();
|
||||||
path.add(FqName.ROOT.toUnsafe());
|
path.add(FqName.ROOT.toUnsafe());
|
||||||
walk(new WalkCallback() {
|
walk(new WalkCallback() {
|
||||||
@Override
|
@Override
|
||||||
@@ -184,7 +184,7 @@ public final class FqNameUnsafe extends FqNameBase {
|
|||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<Name> pathSegments() {
|
public List<Name> pathSegments() {
|
||||||
final List<Name> path = Lists.newArrayList();
|
final List<Name> path = new ArrayList<Name>();
|
||||||
walk(new WalkCallback() {
|
walk(new WalkCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void segment(@NotNull Name shortName, @NotNull FqNameUnsafe fqName) {
|
public void segment(@NotNull Name shortName, @NotNull FqNameUnsafe fqName) {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve.scopes;
|
package org.jetbrains.jet.lang.resolve.scopes;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.TestOnly;
|
import org.jetbrains.annotations.TestOnly;
|
||||||
@@ -24,7 +23,10 @@ import org.jetbrains.jet.lang.descriptors.*;
|
|||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.utils.Printer;
|
import org.jetbrains.jet.utils.Printer;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.jetbrains.jet.lang.resolve.scopes.JetScopeSelectorUtil.*;
|
import static org.jetbrains.jet.lang.resolve.scopes.JetScopeSelectorUtil.*;
|
||||||
|
|
||||||
@@ -73,10 +75,12 @@ public class ChainedScope implements JetScope {
|
|||||||
@Override
|
@Override
|
||||||
public List<ReceiverParameterDescriptor> getImplicitReceiversHierarchy() {
|
public List<ReceiverParameterDescriptor> getImplicitReceiversHierarchy() {
|
||||||
if (implicitReceiverHierarchy == null) {
|
if (implicitReceiverHierarchy == null) {
|
||||||
implicitReceiverHierarchy = Lists.newArrayList();
|
ArrayList<ReceiverParameterDescriptor> result = new ArrayList<ReceiverParameterDescriptor>();
|
||||||
for (JetScope jetScope : scopeChain) {
|
for (JetScope jetScope : scopeChain) {
|
||||||
implicitReceiverHierarchy.addAll(jetScope.getImplicitReceiversHierarchy());
|
result.addAll(jetScope.getImplicitReceiversHierarchy());
|
||||||
}
|
}
|
||||||
|
result.trimToSize();
|
||||||
|
implicitReceiverHierarchy = result;
|
||||||
}
|
}
|
||||||
return implicitReceiverHierarchy;
|
return implicitReceiverHierarchy;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.types;
|
package org.jetbrains.jet.lang.types;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -24,6 +23,7 @@ import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
|||||||
import org.jetbrains.jet.lang.resolve.scopes.SubstitutingScope;
|
import org.jetbrains.jet.lang.resolve.scopes.SubstitutingScope;
|
||||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -192,9 +192,10 @@ public class TypeSubstitutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TypeProjection> substituteTypeArguments(List<TypeParameterDescriptor> typeParameters, List<TypeProjection> typeArguments, int recursionDepth)
|
private List<TypeProjection> substituteTypeArguments(
|
||||||
throws SubstitutionException {
|
List<TypeParameterDescriptor> typeParameters, List<TypeProjection> typeArguments, int recursionDepth
|
||||||
List<TypeProjection> substitutedArguments = Lists.newArrayList();
|
) throws SubstitutionException {
|
||||||
|
List<TypeProjection> substitutedArguments = new ArrayList<TypeProjection>(typeParameters.size());
|
||||||
for (int i = 0; i < typeParameters.size(); i++) {
|
for (int i = 0; i < typeParameters.size(); i++) {
|
||||||
TypeParameterDescriptor typeParameter = typeParameters.get(i);
|
TypeParameterDescriptor typeParameter = typeParameters.get(i);
|
||||||
TypeProjection typeArgument = typeArguments.get(i);
|
TypeProjection typeArgument = typeArguments.get(i);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.types;
|
package org.jetbrains.jet.lang.types;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import kotlin.Function1;
|
import kotlin.Function1;
|
||||||
@@ -139,7 +138,7 @@ public class TypeUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isIntersectionEmpty(@NotNull JetType typeA, @NotNull JetType typeB) {
|
public static boolean isIntersectionEmpty(@NotNull JetType typeA, @NotNull JetType typeB) {
|
||||||
return intersect(JetTypeChecker.DEFAULT, Sets.newLinkedHashSet(Lists.newArrayList(typeA, typeB))) == null;
|
return intersect(JetTypeChecker.DEFAULT, Sets.newLinkedHashSet(Arrays.asList(typeA, typeB))) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -156,7 +155,7 @@ public class TypeUtils {
|
|||||||
// made nullable is they all were nullable
|
// made nullable is they all were nullable
|
||||||
boolean allNullable = true;
|
boolean allNullable = true;
|
||||||
boolean nothingTypePresent = false;
|
boolean nothingTypePresent = false;
|
||||||
List<JetType> nullabilityStripped = Lists.newArrayList();
|
List<JetType> nullabilityStripped = new ArrayList<JetType>(types.size());
|
||||||
for (JetType type : types) {
|
for (JetType type : types) {
|
||||||
nothingTypePresent |= KotlinBuiltIns.getInstance().isNothingOrNullableNothing(type);
|
nothingTypePresent |= KotlinBuiltIns.getInstance().isNothingOrNullableNothing(type);
|
||||||
allNullable &= type.isNullable();
|
allNullable &= type.isNullable();
|
||||||
@@ -168,7 +167,7 @@ public class TypeUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now we remove types that have subtypes in the list
|
// Now we remove types that have subtypes in the list
|
||||||
List<JetType> resultingTypes = Lists.newArrayList();
|
List<JetType> resultingTypes = new ArrayList<JetType>();
|
||||||
outer:
|
outer:
|
||||||
for (JetType type : nullabilityStripped) {
|
for (JetType type : nullabilityStripped) {
|
||||||
if (!canHaveSubtypes(typeChecker, type)) {
|
if (!canHaveSubtypes(typeChecker, type)) {
|
||||||
@@ -372,21 +371,18 @@ public class TypeUtils {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void collectImmediateSupertypes(@NotNull JetType type, @NotNull Collection<JetType> result) {
|
@NotNull
|
||||||
|
public static List<JetType> getImmediateSupertypes(@NotNull JetType type) {
|
||||||
boolean isNullable = type.isNullable();
|
boolean isNullable = type.isNullable();
|
||||||
TypeSubstitutor substitutor = TypeSubstitutor.create(type);
|
TypeSubstitutor substitutor = TypeSubstitutor.create(type);
|
||||||
for (JetType supertype : type.getConstructor().getSupertypes()) {
|
Collection<JetType> originalSupertypes = type.getConstructor().getSupertypes();
|
||||||
|
List<JetType> result = new ArrayList<JetType>(originalSupertypes.size());
|
||||||
|
for (JetType supertype : originalSupertypes) {
|
||||||
JetType substitutedType = substitutor.substitute(supertype, Variance.INVARIANT);
|
JetType substitutedType = substitutor.substitute(supertype, Variance.INVARIANT);
|
||||||
if (substitutedType != null) {
|
if (substitutedType != null) {
|
||||||
result.add(makeNullableIfNeeded(substitutedType, isNullable));
|
result.add(makeNullableIfNeeded(substitutedType, isNullable));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static List<JetType> getImmediateSupertypes(@NotNull JetType type) {
|
|
||||||
List<JetType> result = Lists.newArrayList();
|
|
||||||
collectImmediateSupertypes(type, result);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,8 +613,9 @@ public class TypeUtils {
|
|||||||
@Override
|
@Override
|
||||||
public Iterable<JetType> getNeighbors(JetType current) {
|
public Iterable<JetType> getNeighbors(JetType current) {
|
||||||
TypeSubstitutor substitutor = TypeSubstitutor.create(current);
|
TypeSubstitutor substitutor = TypeSubstitutor.create(current);
|
||||||
List<JetType> result = Lists.newArrayList();
|
Collection<JetType> supertypes = current.getConstructor().getSupertypes();
|
||||||
for (JetType supertype : current.getConstructor().getSupertypes()) {
|
List<JetType> result = new ArrayList<JetType>(supertypes.size());
|
||||||
|
for (JetType supertype : supertypes) {
|
||||||
if (visited.contains(supertype.getConstructor())) {
|
if (visited.contains(supertype.getConstructor())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package org.jetbrains.jet.lang.types.lang;
|
package org.jetbrains.jet.lang.types.lang;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import kotlin.KotlinPackage;
|
import kotlin.KotlinPackage;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -783,13 +782,14 @@ public class KotlinBuiltIns {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public List<ValueParameterDescriptor> getValueParameters(@NotNull FunctionDescriptor functionDescriptor, @NotNull JetType type) {
|
public List<ValueParameterDescriptor> getValueParameters(@NotNull FunctionDescriptor functionDescriptor, @NotNull JetType type) {
|
||||||
assert isFunctionOrExtensionFunctionType(type);
|
assert isFunctionOrExtensionFunctionType(type);
|
||||||
List<ValueParameterDescriptor> valueParameters = Lists.newArrayList();
|
|
||||||
List<TypeProjection> parameterTypes = getParameterTypeProjectionsFromFunctionType(type);
|
List<TypeProjection> parameterTypes = getParameterTypeProjectionsFromFunctionType(type);
|
||||||
|
List<ValueParameterDescriptor> valueParameters = new ArrayList<ValueParameterDescriptor>(parameterTypes.size());
|
||||||
for (int i = 0; i < parameterTypes.size(); i++) {
|
for (int i = 0; i < parameterTypes.size(); i++) {
|
||||||
TypeProjection parameterType = parameterTypes.get(i);
|
TypeProjection parameterType = parameterTypes.get(i);
|
||||||
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
|
||||||
functionDescriptor, null, i, Annotations.EMPTY,
|
functionDescriptor, null, i, Annotations.EMPTY,
|
||||||
Name.identifier("p" + (i + 1)), parameterType.getType(), false, null, SourceElement.NO_SOURCE);
|
Name.identifier("p" + (i + 1)), parameterType.getType(), false, null, SourceElement.NO_SOURCE
|
||||||
|
);
|
||||||
valueParameters.add(valueParameterDescriptor);
|
valueParameters.add(valueParameterDescriptor);
|
||||||
}
|
}
|
||||||
return valueParameters;
|
return valueParameters;
|
||||||
@@ -808,7 +808,7 @@ public class KotlinBuiltIns {
|
|||||||
List<TypeProjection> arguments = type.getArguments();
|
List<TypeProjection> arguments = type.getArguments();
|
||||||
int first = isExtensionFunctionType(type) ? 1 : 0;
|
int first = isExtensionFunctionType(type) ? 1 : 0;
|
||||||
int last = arguments.size() - 2;
|
int last = arguments.size() - 2;
|
||||||
List<TypeProjection> parameterTypes = Lists.newArrayList();
|
List<TypeProjection> parameterTypes = new ArrayList<TypeProjection>(last - first + 1);
|
||||||
for (int i = first; i <= last; i++) {
|
for (int i = first; i <= last; i++) {
|
||||||
parameterTypes.add(arguments.get(i));
|
parameterTypes.add(arguments.get(i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.renderer;
|
package org.jetbrains.jet.renderer;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import kotlin.Function1;
|
import kotlin.Function1;
|
||||||
import kotlin.KotlinPackage;
|
import kotlin.KotlinPackage;
|
||||||
@@ -248,7 +247,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
return klass.getTypeConstructor().toString();
|
return klass.getTypeConstructor().toString();
|
||||||
}
|
}
|
||||||
if (shortNames) {
|
if (shortNames) {
|
||||||
List<Name> qualifiedNameElements = Lists.newArrayList();
|
List<Name> qualifiedNameElements = new ArrayList<Name>();
|
||||||
|
|
||||||
// for nested classes qualified name should be used
|
// for nested classes qualified name should be used
|
||||||
DeclarationDescriptor current = klass;
|
DeclarationDescriptor current = klass;
|
||||||
@@ -415,8 +414,9 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private List<String> renderAndSortAnnotationArguments(@NotNull AnnotationDescriptor descriptor) {
|
private List<String> renderAndSortAnnotationArguments(@NotNull AnnotationDescriptor descriptor) {
|
||||||
List<String> resultList = Lists.newArrayList();
|
Set<Map.Entry<ValueParameterDescriptor, CompileTimeConstant<?>>> valueArguments = descriptor.getAllValueArguments().entrySet();
|
||||||
for (Map.Entry<ValueParameterDescriptor, CompileTimeConstant<?>> entry : descriptor.getAllValueArguments().entrySet()) {
|
List<String> resultList = new ArrayList<String>(valueArguments.size());
|
||||||
|
for (Map.Entry<ValueParameterDescriptor, CompileTimeConstant<?>> entry : valueArguments) {
|
||||||
CompileTimeConstant<?> value = entry.getValue();
|
CompileTimeConstant<?> value = entry.getValue();
|
||||||
String typeSuffix = ": " + renderType(value.getType(KotlinBuiltIns.getInstance()));
|
String typeSuffix = ": " + renderType(value.getType(KotlinBuiltIns.getInstance()));
|
||||||
resultList.add(entry.getKey().getName().asString() + " = " + renderConstant(value) + typeSuffix);
|
resultList.add(entry.getKey().getName().asString() + " = " + renderConstant(value) + typeSuffix);
|
||||||
@@ -665,7 +665,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
private void renderWhereSuffix(@NotNull List<TypeParameterDescriptor> typeParameters, @NotNull StringBuilder builder) {
|
private void renderWhereSuffix(@NotNull List<TypeParameterDescriptor> typeParameters, @NotNull StringBuilder builder) {
|
||||||
if (withoutTypeParameters) return;
|
if (withoutTypeParameters) return;
|
||||||
|
|
||||||
List<String> upperBoundStrings = Lists.newArrayList();
|
List<String> upperBoundStrings = new ArrayList<String>(0);
|
||||||
|
|
||||||
for (TypeParameterDescriptor typeParameter : typeParameters) {
|
for (TypeParameterDescriptor typeParameter : typeParameters) {
|
||||||
if (typeParameter.getUpperBounds().size() > 1) {
|
if (typeParameter.getUpperBounds().size() > 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user