Skip to content

Commit ff49b0b

Browse files
committed
Align AnnotatedMethod#equals and #hashcode
See gh-34375
1 parent 56c4d2d commit ff49b0b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: spring-core/src/main/java/org/springframework/core/annotation/AnnotatedMethod.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -214,8 +214,8 @@ private boolean isOverrideFor(Method candidate) {
214214

215215
@Override
216216
public boolean equals(@Nullable Object other) {
217-
return (this == other || (other != null && getClass() == other.getClass() &&
218-
this.method.equals(((AnnotatedMethod) other).method)));
217+
return (this == other || (other instanceof AnnotatedMethod otherHandlerMethod &&
218+
this.method.equals(otherHandlerMethod.method)));
219219
}
220220

221221
@Override

0 commit comments

Comments
 (0)