Skip to content

Commit a4679b8

Browse files
committed
Fix Checkstyle violation and rearrange getAdvisorCount declaration
See gh-26017
1 parent fbf8e37 commit a4679b8

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

spring-aop/src/main/java/org/springframework/aop/framework/Advised.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ public interface Advised extends TargetClassAware {
114114
*/
115115
Advisor[] getAdvisors();
116116

117+
/**
118+
* Return the number of advisors applying to this proxy.
119+
* <p>The default implementation delegates to {@code getAdvisors().length}.
120+
* @since 5.3.1
121+
*/
122+
default int getAdvisorCount() {
123+
return getAdvisors().length;
124+
}
125+
117126
/**
118127
* Add an advisor at the end of the advisor chain.
119128
* <p>The Advisor may be an {@link org.springframework.aop.IntroductionAdvisor},
@@ -223,12 +232,4 @@ public interface Advised extends TargetClassAware {
223232
*/
224233
String toProxyConfigString();
225234

226-
/**
227-
* Equivalent to {@code getAdvisors().length}
228-
* @return count of advisors of this advised
229-
*/
230-
default int getAdvisorCount() {
231-
return getAdvisors().length;
232-
}
233-
234235
}

spring-aop/src/main/java/org/springframework/aop/framework/AdvisedSupport.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,11 @@ public final Advisor[] getAdvisors() {
241241
return this.advisors.toArray(new Advisor[0]);
242242
}
243243

244+
@Override
245+
public int getAdvisorCount() {
246+
return this.advisors.size();
247+
}
248+
244249
@Override
245250
public void addAdvisor(Advisor advisor) {
246251
int pos = this.advisors.size();
@@ -534,11 +539,6 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
534539
this.methodCache = new ConcurrentHashMap<>(32);
535540
}
536541

537-
@Override
538-
public int getAdvisorCount() {
539-
return advisors.size();
540-
}
541-
542542
@Override
543543
public String toProxyConfigString() {
544544
return toString();

0 commit comments

Comments
 (0)