forked from I2P_Developers/i2p.i2p
lint router
This commit is contained in:
@@ -339,7 +339,7 @@ public class RouterInfo extends DatabaseEntry {
|
||||
// WARNING this sort algorithm cannot be changed, as it must be consistent
|
||||
// network-wide. The signature is not checked at readin time, but only
|
||||
// later, and the hashes are stored in a Set, not a List.
|
||||
peers = (Collection<Hash>) SortHelper.sortStructures(peers);
|
||||
peers = SortHelper.sortStructures(peers);
|
||||
for (Hash peerHash : peers) {
|
||||
peerHash.writeBytes(out);
|
||||
}
|
||||
|
||||
@@ -31,12 +31,11 @@ class SortHelper {
|
||||
* WARNING - this sort order must be consistent network-wide, so while the order is arbitrary,
|
||||
* it cannot be changed.
|
||||
* Why? Just because it has to be consistent so signing will work.
|
||||
* How to spec as returning the same type as the param?
|
||||
* DEPRECATED - Only used by RouterInfo.
|
||||
*
|
||||
* @return a new list
|
||||
*/
|
||||
public static List<? extends DataStructure> sortStructures(Collection<? extends DataStructure> dataStructures) {
|
||||
public static <T extends DataStructure> List<T> sortStructures(Collection<T> dataStructures) {
|
||||
if (dataStructures == null) return Collections.emptyList();
|
||||
|
||||
// This used to use Hash.toString(), which is insane, since a change to toString()
|
||||
@@ -52,7 +51,7 @@ class SortHelper {
|
||||
//for (DataStructure struct : tm.values()) {
|
||||
// rv.add(struct);
|
||||
//}
|
||||
ArrayList<DataStructure> rv = new ArrayList<DataStructure>(dataStructures);
|
||||
ArrayList<T> rv = new ArrayList<T>(dataStructures);
|
||||
sortStructureList(rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user