Skip to content

Commit bf2aaa1

Browse files
committed
Use .equals to Compare Methods
Closes gh-17143
1 parent 3690517 commit bf2aaa1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

aspects/src/test/java/org/springframework/security/authorization/method/aspectj/PreAuthorizeAspectTests.java

Lines changed: 2 additions & 2 deletions
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.
@@ -144,7 +144,7 @@ private void privateMethod() {
144144
protected void protectedMethod() {
145145
}
146146

147-
@PreAuthorize("hasRole('X')")
147+
@PreAuthorize("hasRole('A')")
148148
void publicCallsPrivate() {
149149
privateMethod();
150150
}

core/src/main/java/org/springframework/security/core/annotation/UniqueSecurityAnnotationScanner.java

Lines changed: 2 additions & 2 deletions
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,7 +214,7 @@ private List<MergedAnnotation<A>> findDirectAnnotations(AnnotatedElement element
214214

215215
private static Method findMethod(Method method, Class<?> targetClass) {
216216
for (Method candidate : targetClass.getDeclaredMethods()) {
217-
if (candidate == method) {
217+
if (candidate.equals(method)) {
218218
return candidate;
219219
}
220220
if (isOverride(method, candidate)) {

0 commit comments

Comments
 (0)