Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
*
* @author Ramnivas Laddad
* @author Chris Beams
* @author Yanming Zhou
*/
class AfterReturningGenericTypeMatchingTests {

Expand Down Expand Up @@ -107,77 +108,74 @@ void returnTypeLowerBoundMatching() {
assertThat(counterAspect.getTestBeanInvocationsCount).isEqualTo(0);
}

}

static class GenericReturnTypeVariationClass {

class GenericReturnTypeVariationClass {
public Collection<String> getStrings() {
return new ArrayList<>();
}

public Collection<String> getStrings() {
return new ArrayList<>();
}
public Collection<Integer> getIntegers() {
return new ArrayList<>();
}

public Collection<Integer> getIntegers() {
return new ArrayList<>();
}
public Collection<TestBean> getTestBeans() {
return new ArrayList<>();
}

public Collection<TestBean> getTestBeans() {
return new ArrayList<>();
public Collection<Employee> getEmployees() {
return new ArrayList<>();
}
}

public Collection<Employee> getEmployees() {
return new ArrayList<>();
}
}

@Aspect
static class CounterAspect {

@Aspect
class CounterAspect {
int getRawsInvocationsCount;

int getRawsInvocationsCount;
int getStringsInvocationsCount;

int getStringsInvocationsCount;
int getIntegersInvocationsCount;

int getIntegersInvocationsCount;
int getNumbersInvocationsCount;

int getNumbersInvocationsCount;
int getTestBeanInvocationsCount;

int getTestBeanInvocationsCount;
@Pointcut("execution(* org.springframework.aop.aspectj.generic.AfterReturningGenericTypeMatchingTests.GenericReturnTypeVariationClass.*(..))")
public void anyTestMethod() {
}

@Pointcut("execution(* org.springframework.aop.aspectj.generic.GenericReturnTypeVariationClass.*(..))")
public void anyTestMethod() {
}
@AfterReturning(pointcut = "anyTestMethod()", returning = "ret")
public void incrementGetRawsInvocationsCount(Collection<?> ret) {
getRawsInvocationsCount++;
}

@AfterReturning(pointcut = "anyTestMethod()", returning = "ret")
public void incrementGetRawsInvocationsCount(Collection<?> ret) {
getRawsInvocationsCount++;
}
@AfterReturning(pointcut = "anyTestMethod()", returning = "ret")
public void incrementGetStringsInvocationsCount(Collection<String> ret) {
getStringsInvocationsCount++;
}

@AfterReturning(pointcut = "anyTestMethod()", returning = "ret")
public void incrementGetStringsInvocationsCount(Collection<String> ret) {
getStringsInvocationsCount++;
}
@AfterReturning(pointcut = "anyTestMethod()", returning = "ret")
public void incrementGetIntegersInvocationsCount(Collection<Integer> ret) {
getIntegersInvocationsCount++;
}

@AfterReturning(pointcut = "anyTestMethod()", returning = "ret")
public void incrementGetIntegersInvocationsCount(Collection<Integer> ret) {
getIntegersInvocationsCount++;
}
@AfterReturning(pointcut = "anyTestMethod()", returning = "ret")
public void incrementGetNumbersInvocationsCount(Collection<? extends Number> ret) {
getNumbersInvocationsCount++;
}

@AfterReturning(pointcut = "anyTestMethod()", returning = "ret")
public void incrementGetNumbersInvocationsCount(Collection<? extends Number> ret) {
getNumbersInvocationsCount++;
}
@AfterReturning(pointcut = "anyTestMethod()", returning = "ret")
public void incrementTestBeanInvocationsCount(Collection<? super TestBean> ret) {
getTestBeanInvocationsCount++;
}

@AfterReturning(pointcut = "anyTestMethod()", returning = "ret")
public void incrementTestBeanInvocationsCount(Collection<? super TestBean> ret) {
getTestBeanInvocationsCount++;
public void reset() {
getRawsInvocationsCount = 0;
getStringsInvocationsCount = 0;
getIntegersInvocationsCount = 0;
getNumbersInvocationsCount = 0;
getTestBeanInvocationsCount = 0;
}
}

public void reset() {
getRawsInvocationsCount = 0;
getStringsInvocationsCount = 0;
getIntegersInvocationsCount = 0;
getNumbersInvocationsCount = 0;
getTestBeanInvocationsCount = 0;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
*
* @author Ramnivas Laddad
* @author Chris Beams
* @author Yanming Zhou
*/
class GenericBridgeMethodMatchingTests {

Expand Down Expand Up @@ -79,41 +80,39 @@ void genericBaseInterfaceMethodThroughInterface() {
assertThat(counterAspect.count).isEqualTo(1);
}

}
interface BaseInterface<T> {

void genericBaseInterfaceMethod(T t);
}

interface BaseInterface<T> {

void genericBaseInterfaceMethod(T t);
}
interface DerivedInterface<T> extends BaseInterface<T> {

void genericDerivedInterfaceMethod(T t);
}

interface DerivedInterface<T> extends BaseInterface<T> {

void genericDerivedInterfaceMethod(T t);
}
static class DerivedStringParameterizedClass implements DerivedInterface<String> {

@Override
public void genericDerivedInterfaceMethod(String t) {
}

class DerivedStringParameterizedClass implements DerivedInterface<String> {

@Override
public void genericDerivedInterfaceMethod(String t) {
@Override
public void genericBaseInterfaceMethod(String t) {
}
}

@Override
public void genericBaseInterfaceMethod(String t) {
}
}
@Aspect
static class GenericCounterAspect {

@Aspect
class GenericCounterAspect {
public int count;

public int count;
@Before("execution(* *..BaseInterface+.*(..))")
public void increment() {
count++;
}

@Before("execution(* *..BaseInterface+.*(..))")
public void increment() {
count++;
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

<aop:aspectj-autoproxy/>

<bean id="counterAspect" class="org.springframework.aop.aspectj.generic.CounterAspect"/>
<bean id="counterAspect" class="org.springframework.aop.aspectj.generic.AfterReturningGenericTypeMatchingTests$CounterAspect"/>

<bean id="testBean" class="org.springframework.aop.aspectj.generic.GenericReturnTypeVariationClass"/>
<bean id="testBean" class="org.springframework.aop.aspectj.generic.AfterReturningGenericTypeMatchingTests$GenericReturnTypeVariationClass"/>

</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

<aop:aspectj-autoproxy proxy-target-class="true"/>

<bean id="counterAspect" class="org.springframework.aop.aspectj.generic.GenericCounterAspect"/>
<bean id="counterAspect" class="org.springframework.aop.aspectj.generic.GenericBridgeMethodMatchingTests$GenericCounterAspect"/>

<bean id="testBean" class="org.springframework.aop.aspectj.generic.DerivedStringParameterizedClass"/>
<bean id="testBean" class="org.springframework.aop.aspectj.generic.GenericBridgeMethodMatchingTests$DerivedStringParameterizedClass"/>

</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

<aop:aspectj-autoproxy proxy-target-class="false"/>

<bean id="counterAspect" class="org.springframework.aop.aspectj.generic.GenericCounterAspect"/>
<bean id="counterAspect" class="org.springframework.aop.aspectj.generic.GenericBridgeMethodMatchingTests$GenericCounterAspect"/>

<bean id="testBean" class="org.springframework.aop.aspectj.generic.DerivedStringParameterizedClass"/>
<bean id="testBean" class="org.springframework.aop.aspectj.generic.GenericBridgeMethodMatchingTests$DerivedStringParameterizedClass"/>

</beans>