mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8210683: Search result display order reversed for overloaded entries
Reviewed-by: jjg
This commit is contained in:
parent
6b83ac96ab
commit
bfb6aa4821
1 changed files with 18 additions and 1 deletions
|
@ -30,6 +30,8 @@ import java.lang.ref.SoftReference;
|
|||
import java.net.URI;
|
||||
import java.text.CollationKey;
|
||||
import java.text.Collator;
|
||||
import java.text.ParseException;
|
||||
import java.text.RuleBasedCollator;
|
||||
import java.util.*;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.Map.Entry;
|
||||
|
@ -1588,7 +1590,7 @@ public class Utils {
|
|||
private final Collator instance;
|
||||
private final int MAX_SIZE = 1000;
|
||||
private DocCollator(Locale locale, int strength) {
|
||||
instance = Collator.getInstance(locale);
|
||||
instance = createCollator(locale);
|
||||
instance.setStrength(strength);
|
||||
|
||||
keys = new LinkedHashMap<String, CollationKey>(MAX_SIZE + 1, 0.75f, true) {
|
||||
|
@ -1607,6 +1609,21 @@ public class Utils {
|
|||
public int compare(String s1, String s2) {
|
||||
return getKey(s1).compareTo(getKey(s2));
|
||||
}
|
||||
|
||||
private Collator createCollator(Locale locale) {
|
||||
Collator baseCollator = Collator.getInstance(locale);
|
||||
if (baseCollator instanceof RuleBasedCollator) {
|
||||
// Extend collator to sort signatures with additional args and var-args in a well-defined order:
|
||||
// () < (int) < (int, int) < (int...)
|
||||
try {
|
||||
return new RuleBasedCollator(((RuleBasedCollator) baseCollator).getRules()
|
||||
+ "& ')' < ',' < '.','['");
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return baseCollator;
|
||||
}
|
||||
}
|
||||
|
||||
private Comparator<Element> moduleComparator = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue