Get rid of LinkedHashSet in some places in favor of ArrayList
This commit is contained in:
+8
-7
@@ -23,7 +23,10 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescriptorNonRootImpl implements PropertyAccessorDescriptor {
|
||||
|
||||
@@ -140,16 +143,14 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
|
||||
@NotNull
|
||||
protected Collection<PropertyAccessorDescriptor> getOverriddenDescriptors(boolean isGetter) {
|
||||
Collection<? extends PropertyDescriptor> overriddenProperties = getCorrespondingProperty().getOverriddenDescriptors();
|
||||
// LinkedHashSet for determinism
|
||||
Set<PropertyAccessorDescriptor> overriddenAccessors = new LinkedHashSet<PropertyAccessorDescriptor>();
|
||||
for (PropertyDescriptor overriddenProperty : overriddenProperties) {
|
||||
Collection<PropertyAccessorDescriptor> result = new ArrayList<PropertyAccessorDescriptor>(0);
|
||||
for (PropertyDescriptor overriddenProperty : getCorrespondingProperty().getOverriddenDescriptors()) {
|
||||
PropertyAccessorDescriptor accessorDescriptor = isGetter ? overriddenProperty.getGetter() : overriddenProperty.getSetter();
|
||||
if (accessorDescriptor != null) {
|
||||
overriddenAccessors.add(accessorDescriptor);
|
||||
result.add(accessorDescriptor);
|
||||
}
|
||||
}
|
||||
return overriddenAccessors;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-10
@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class ValueParameterDescriptorImpl extends VariableDescriptorImpl implements ValueParameterDescriptor {
|
||||
private final boolean declaresDefaultValue;
|
||||
@@ -123,14 +122,13 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<? extends ValueParameterDescriptor> getOverriddenDescriptors() {
|
||||
Collection<? extends CallableDescriptor> overriddenFunctions = getContainingDeclaration().getOverriddenDescriptors();
|
||||
if (overriddenFunctions.isEmpty()) return Collections.emptySet();
|
||||
|
||||
return KotlinPackage.toSet(KotlinPackage.map(overriddenFunctions, new Function1<CallableDescriptor, ValueParameterDescriptor>() {
|
||||
@Override
|
||||
public ValueParameterDescriptor invoke(CallableDescriptor descriptor) {
|
||||
return descriptor.getValueParameters().get(getIndex());
|
||||
}
|
||||
}));
|
||||
return KotlinPackage.map(
|
||||
getContainingDeclaration().getOverriddenDescriptors(),
|
||||
new Function1<CallableDescriptor, ValueParameterDescriptor>() {
|
||||
@Override
|
||||
public ValueParameterDescriptor invoke(CallableDescriptor descriptor) {
|
||||
return descriptor.getValueParameters().get(getIndex());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user