mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-03 06:58:23 +00:00
8042601: Javadoc sort fails
Reviewed-by: jjg
This commit is contained in:
parent
5b6afc8503
commit
1f1c8d7506
@ -878,8 +878,9 @@ public class Util {
|
||||
*/
|
||||
static abstract class DocComparator<T extends Doc> implements Comparator<Doc> {
|
||||
/**
|
||||
* compares two parameter arrays by first comparing the length of the arrays, and
|
||||
* then each Type of the parameter in the array.
|
||||
* compares two parameter arrays by comparing each Type of the parameter in the array,
|
||||
* as possible, if the matched strings are identical, and have mismatched array lengths
|
||||
* then compare the lengths.
|
||||
* @param params1 the first parameter array.
|
||||
* @param params2 the first parameter array.
|
||||
* @return a negative integer, zero, or a positive integer as the first
|
||||
@ -889,17 +890,14 @@ public class Util {
|
||||
if (params1.length == 0 && params2.length == 0) {
|
||||
return 0;
|
||||
}
|
||||
int result = Integer.compare(params1.length, params2.length);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
for (int i = 0; i < params1.length; i++) {
|
||||
result = compareStrings(params1[i].typeName(), params2[i].typeName());
|
||||
// try to compare as many as possible
|
||||
for (int i = 0; i < params1.length && i < params2.length; i++) {
|
||||
int result = compareStrings(params1[i].typeName(), params2[i].typeName());
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return Integer.compare(params1.length, params2.length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8039410
|
||||
* @bug 8039410 8042601
|
||||
* @summary test to determine if members are ordered correctly
|
||||
* @author ksrini
|
||||
* @library ../lib/
|
||||
@ -108,19 +108,28 @@ public class TestOrdering extends JavadocTester {
|
||||
|
||||
static void checkIndexPathOrdering(String indexPage) {
|
||||
String[] OrderedExpectedStrings = {
|
||||
"pkg1/UsedClass.html#add-java.lang.Double",
|
||||
"pkg1/ZZTop.html#add-double",
|
||||
"pkg1/ZZTop.html#add-java.lang.Double",
|
||||
"pkg1/UsedClass.html#add-float",
|
||||
"pkg1/ZZTop.html#add-float",
|
||||
"pkg1/UsedClass.html#add-int",
|
||||
"pkg1/ZZTop.html#add-int",
|
||||
"pkg1/UsedClass.html#add-java.lang.Integer",
|
||||
"pkg1/ZZTop.html#add-java.lang.Integer",
|
||||
"pkg1/UsedClass.html#add-double-double",
|
||||
"pkg1/UsedClass.html#add-double-java.lang.Double",
|
||||
"pkg1/ZZTop.html#add-double-double",
|
||||
"pkg1/ZZTop.html#add-double-java.lang.Double"
|
||||
"pkg1/UsedClass.html#add--",
|
||||
"pkg1/ZZTop.html#add--",
|
||||
"pkg1/UsedClass.html#add-double-",
|
||||
"pkg1/UsedClass.html#add-java.lang.Double-",
|
||||
"pkg1/ZZTop.html#add-double-",
|
||||
"pkg1/ZZTop.html#add-java.lang.Double-",
|
||||
"pkg1/UsedClass.html#add-double-byte-",
|
||||
"pkg1/ZZTop.html#add-double-byte-",
|
||||
"pkg1/UsedClass.html#add-double-double-",
|
||||
"pkg1/UsedClass.html#add-double-java.lang.Double-",
|
||||
"pkg1/ZZTop.html#add-double-double-",
|
||||
"pkg1/ZZTop.html#add-double-java.lang.Double-",
|
||||
"pkg1/UsedClass.html#add-float-",
|
||||
"pkg1/ZZTop.html#add-float-",
|
||||
"pkg1/UsedClass.html#add-float-int-",
|
||||
"pkg1/ZZTop.html#add-float-int-",
|
||||
"pkg1/UsedClass.html#add-int-",
|
||||
"pkg1/ZZTop.html#add-int-",
|
||||
"pkg1/UsedClass.html#add-int-float-",
|
||||
"pkg1/ZZTop.html#add-int-float-",
|
||||
"pkg1/UsedClass.html#add-java.lang.Integer-",
|
||||
"pkg1/ZZTop.html#add-java.lang.Integer-"
|
||||
};
|
||||
int lastidx = 0;
|
||||
for (String x : OrderedExpectedStrings) {
|
||||
|
||||
@ -26,36 +26,41 @@ package pkg1;
|
||||
* For index and class-use testing
|
||||
*/
|
||||
public class UsedClass {
|
||||
// This is the exact order we expect to see
|
||||
|
||||
/**
|
||||
* @param i param
|
||||
* just an empty param method.
|
||||
*/
|
||||
public void add(int i){}
|
||||
|
||||
/**
|
||||
* @param i param
|
||||
* @return double
|
||||
*/
|
||||
public int add(Integer i) {return 0;}
|
||||
public void add(){}
|
||||
|
||||
/**
|
||||
* @param d param
|
||||
*/
|
||||
public void add(double d){}
|
||||
|
||||
/**
|
||||
* @param i param
|
||||
* @param f param
|
||||
*/
|
||||
public void add(int i, float f){}
|
||||
|
||||
/**
|
||||
* @param f param
|
||||
* @param i param
|
||||
*/
|
||||
public void add(float f, int i){}
|
||||
|
||||
/**
|
||||
* @param d param
|
||||
* @param b param
|
||||
*/
|
||||
public void add(double d, byte b){}
|
||||
|
||||
/**
|
||||
* @param d param
|
||||
* @return Double
|
||||
*/
|
||||
public Double add(Double d) {return (double) 22/7;}
|
||||
|
||||
/**
|
||||
* @param f param
|
||||
* @return Float
|
||||
*/
|
||||
public Float add(float f) {return (float) 22/7;}
|
||||
|
||||
/**
|
||||
* @param d1 param
|
||||
* @param d2 param
|
||||
@ -69,4 +74,21 @@ public class UsedClass {
|
||||
* @return double
|
||||
*/
|
||||
public double add(double d1, Double d2) {return d1 + d2;}
|
||||
|
||||
/**
|
||||
* @param f param
|
||||
* @return Float
|
||||
*/
|
||||
public Float add(float f) {return (float) 22/7;}
|
||||
|
||||
/**
|
||||
* @param i param
|
||||
*/
|
||||
public void add(int i){}
|
||||
|
||||
/**
|
||||
* @param i param
|
||||
* @return double
|
||||
*/
|
||||
public int add(Integer i) {return 0;}
|
||||
}
|
||||
|
||||
@ -26,35 +26,41 @@ package pkg1;
|
||||
* For index testing only
|
||||
*/
|
||||
public class ZZTop {
|
||||
// This is the exact order we expect to see
|
||||
|
||||
/**
|
||||
* @param i param
|
||||
* just an empty param method.
|
||||
*/
|
||||
public void add(int i){}
|
||||
|
||||
/**
|
||||
* @param i param
|
||||
* @return double
|
||||
*/
|
||||
public int add(Integer i) {return 0;}
|
||||
public void add(){}
|
||||
|
||||
/**
|
||||
* @param d param
|
||||
*/
|
||||
public void add(double d){}
|
||||
|
||||
/**
|
||||
* @param i param
|
||||
* @param f param
|
||||
*/
|
||||
public void add(int i, float f){}
|
||||
|
||||
/**
|
||||
* @param f param
|
||||
* @param i param
|
||||
*/
|
||||
public void add(float f, int i){}
|
||||
|
||||
/**
|
||||
* @param d param
|
||||
* @param b param
|
||||
*/
|
||||
public void add(double d, byte b){}
|
||||
|
||||
/**
|
||||
* @param d param
|
||||
* @return Double
|
||||
*/
|
||||
public Double add(Double d) {return (double) 22/7;}
|
||||
|
||||
/**
|
||||
* @param f param
|
||||
* @return Float
|
||||
*/
|
||||
public Float add(float f) {return (float) 22/7;}
|
||||
/**
|
||||
* @param d1 param
|
||||
* @param d2 param
|
||||
@ -68,4 +74,21 @@ public class ZZTop {
|
||||
* @return double
|
||||
*/
|
||||
public double add(double d1, Double d2) {return d1 + d2;}
|
||||
|
||||
/**
|
||||
* @param f param
|
||||
* @return Float
|
||||
*/
|
||||
public Float add(float f) {return (float) 22/7;}
|
||||
|
||||
/**
|
||||
* @param i param
|
||||
*/
|
||||
public void add(int i){}
|
||||
|
||||
/**
|
||||
* @param i param
|
||||
* @return double
|
||||
*/
|
||||
public int add(Integer i) {return 0;}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user