Skip to content

Commit

Permalink
Improve code specifications. (alibaba#8965)
Browse files Browse the repository at this point in the history
Flip the call to equals method to avoid null pointer exception.
  • Loading branch information
shiherua authored Aug 17, 2022
1 parent 8c43096 commit ec134a3
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -867,10 +867,10 @@ public PatternVirtualFileVisitor(String rootPath, String subPattern, PathMatcher
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String methodName = method.getName();
if (Object.class == method.getDeclaringClass()) {
if (methodName.equals("equals")) {
if ("equals".equals(methodName)) {
// Only consider equal when proxies are identical.
return (proxy == args[0]);
} else if (methodName.equals("hashCode")) {
} else if ("hashCode".equals(methodName)) {
return System.identityHashCode(proxy);
}
} else if ("getAttributes".equals(methodName)) {
Expand Down

0 comments on commit ec134a3

Please sign in to comment.