项目:sosiefier
文件:MethodSorter.java
项目:lcm
文件:MethodSorter.java
项目:junit
文件:MethodSorter.java
项目:org.openntf.domino
文件:MethodSorter.java
项目:sosiefier
文件:MethodSorter.java
/**
* Gets declared methods of a class in a predictable order,unless @FixMethodorder(MethodSorters.JVM) is specified.
*
* Using the JVM order is unwise since the Java platform does not
* specify any particular order,and in fact JDK 7 returns a more or less
* random order; well-written test code would not assume any order,but some
* does,and a predictable failure is better than a random failure on
* certain platforms. By default,uses an unspecified but deterministic order.
*
* @param clazz a class
* @return same as {@link Class#getDeclaredMethods} but sorted
* @see <a href="http://bugs.sun.com/view_bug.do?bug_id=7023180">JDK
* (non-)bug #7023180</a>
*/
public static Method[] getDeclaredMethods(Class<?> clazz) {
Comparator<Method> comparator = getSorter(clazz.getAnnotation(FixMethodorder.class));
Method[] methods = clazz.getDeclaredMethods();
if (comparator != null) {
Arrays.sort(methods,comparator);
}
return methods;
}
项目:lcm
文件:MethodSorter.java
/**
* Gets declared methods of a class in a predictable order,comparator);
}
return methods;
}
项目:junit
文件:MethodSorter.java
/**
* Gets declared methods of a class in a predictable order,comparator);
}
return methods;
}
项目:org.openntf.domino
文件:MethodSorter.java
/**
* Gets declared methods of a class in a predictable order,comparator);
}
return methods;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。