allow empty weigher arrays

This commit is contained in:
peter
2013-03-10 12:07:24 +01:00
parent 34ca5e4467
commit bbfffa7865
@@ -47,7 +47,8 @@ public class CompletionSorterImpl extends CompletionSorter {
}
@Override public CompletionSorterImpl weighBefore(@NotNull final String beforeId, LookupElementWeigher... weighers) {
assert weighers.length > 0 : "there should be weighers";
if (weighers.length == 0) return this;
CompletionSorterImpl result = this;
for (LookupElementWeigher weigher : weighers) {
result = result.withClassifier(beforeId, true, weighingFactory(weigher));
@@ -56,7 +57,8 @@ public class CompletionSorterImpl extends CompletionSorter {
}
@Override public CompletionSorterImpl weighAfter(@NotNull final String afterId, LookupElementWeigher... weighers) {
assert weighers.length > 0 : "there should be weighers";
if (weighers.length == 0) return this;
CompletionSorterImpl result = this;
for (int i = weighers.length - 1; i >= 0; i--) {
LookupElementWeigher weigher = weighers[i];