/**
* Returns true if the the given member is a method that overrides {@link Object#equals(Object)}.
*
* <p>The documentation for {@link Object#equals} says it should accept null, so don't require an
* explicit {@code @Nullable} annotation (see <a
* href="https://github.com/google/guava/issues/1819">#1819</a>).
*
* <p>It is not necessary to consider visibility, return type, or type parameter declarations. The
* declaration of a method with the same name and formal parameters as {@link Object#equals} that
* is not public and boolean-returning, or that declares any type parameters, would be rejected at
* compile-time.
*/
private static boolean isEquals(Member member) {
if (!(member instanceof Method)) {
return false;
}
Method method = (Method) member;
if (!method.getName().contentEquals("equals")) {
return false;
}
Class<?>[] parameters = method.getParameterTypes();
if (parameters.length != 1) {
return false;
}
if (!parameters[0].equals(Object.class)) {
return false;
}
return true;
}
NullPointerTester.java 文件源码
java
阅读 55
收藏 0
点赞 0
评论 0
项目:googles-monorepo-demo
作者:
评论列表
文章目录