diff --git a/spring-aop/src/main/java/org/springframework/aop/IntroductionAwareMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/IntroductionAwareMethodMatcher.java index b8f7526619..ed228bfa20 100644 --- a/spring-aop/src/main/java/org/springframework/aop/IntroductionAwareMethodMatcher.java +++ b/spring-aop/src/main/java/org/springframework/aop/IntroductionAwareMethodMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,9 @@ package org.springframework.aop; import java.lang.reflect.Method; /** - * A specialized type of MethodMatcher that takes into account introductions when - * matching methods. If there are no introductions on the target class, a method - * matcher may be able to optimize matching more effectively for example. + * A specialized type of {@link MethodMatcher} that takes into account introductions + * when matching methods. If there are no introductions on the target class, + * a method matcher may be able to optimize matching more effectively for example. * * @author Adrian Colyer * @since 2.0 diff --git a/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java b/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java index 2c2b49597f..c58a5bc41a 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/ClassFilters.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,7 @@ import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; /** - * Static utility methods for composing - * {@link org.springframework.aop.ClassFilter ClassFilters}. + * Static utility methods for composing {@link ClassFilter ClassFilters}. * * @author Rod Johnson * @author Rob Harrop @@ -98,8 +97,8 @@ public abstract class ClassFilters { @Override public boolean matches(Class> clazz) { - for (int i = 0; i < this.filters.length; i++) { - if (this.filters[i].matches(clazz)) { + for (ClassFilter filter : this.filters) { + if (filter.matches(clazz)) { return true; } } @@ -133,8 +132,8 @@ public abstract class ClassFilters { @Override public boolean matches(Class> clazz) { - for (int i = 0; i < this.filters.length; i++) { - if (!this.filters[i].matches(clazz)) { + for (ClassFilter filter : this.filters) { + if (!filter.matches(clazz)) { return false; } } diff --git a/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java b/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java index cddacd8888..b71e2c2399 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/MethodMatchers.java @@ -25,12 +25,11 @@ import org.springframework.aop.MethodMatcher; import org.springframework.util.Assert; /** - * Static utility methods for composing - * {@link org.springframework.aop.MethodMatcher MethodMatchers}. + * Static utility methods for composing {@link MethodMatcher MethodMatchers}. * - *
A MethodMatcher may be evaluated statically (based on method - * and target class) or need further evaluation dynamically - * (based on arguments at the time of method invocation). + *
A MethodMatcher may be evaluated statically (based on method and target + * class) or need further evaluation dynamically (based on arguments at the + * time of method invocation). * * @author Rod Johnson * @author Rob Harrop diff --git a/spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java b/spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java index f01bf14a47..5e71d7d154 100644 --- a/spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java +++ b/spring-context/src/test/java/org/springframework/aop/aspectj/TargetPointcutSelectionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,16 +34,21 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public final class TargetPointcutSelectionTests { public TestInterface testImpl1; + public TestInterface testImpl2; + public TestAspect testAspectForTestImpl1; + public TestAspect testAspectForAbstractTestImpl; + public TestInterceptor testInterceptor; @Before public void setUp() { ClassPathXmlApplicationContext ctx = - new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); + new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); + testImpl1 = (TestInterface) ctx.getBean("testImpl1"); testImpl2 = (TestInterface) ctx.getBean("testImpl2"); testAspectForTestImpl1 = (TestAspect) ctx.getBean("testAspectForTestImpl1"); @@ -55,6 +60,7 @@ public final class TargetPointcutSelectionTests { testInterceptor.count = 0; } + @Test public void testTargetSelectionForMatchedType() { testImpl1.interfaceMethod();