Adding @AjSuppressWarnings on some advices

Issue: SPR-12239
This commit is contained in:
Janning Vygen 2014-09-30 21:06:55 +02:00 committed by Stephane Nicoll
parent a86402899d
commit 6950d5517b
3 changed files with 10 additions and 1 deletions

View File

@ -19,6 +19,8 @@ package org.springframework.mock.staticmock;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import org.aspectj.lang.annotation.SuppressAjWarnings;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
/** /**
@ -227,6 +229,7 @@ public abstract aspect AbstractMethodMockingControl percflow(mockStaticsTestMeth
*/ */
protected abstract pointcut methodToMock(); protected abstract pointcut methodToMock();
@SuppressAjWarnings("adviceDidNotMatch")
after() returning : mockStaticsTestMethod() { after() returning : mockStaticsTestMethod() {
if (recording && (expectations.hasCalls())) { if (recording && (expectations.hasCalls())) {
throw new IllegalStateException( throw new IllegalStateException(
@ -236,6 +239,7 @@ public abstract aspect AbstractMethodMockingControl percflow(mockStaticsTestMeth
verifyInternal(); verifyInternal();
} }
@SuppressAjWarnings("adviceDidNotMatch")
Object around() : methodToMock() && cflowbelow(mockStaticsTestMethod()) { Object around() : methodToMock() && cflowbelow(mockStaticsTestMethod()) {
if (recording) { if (recording) {
expectations.expectCall(thisJoinPointStaticPart.toLongString(), thisJoinPoint.getArgs()); expectations.expectCall(thisJoinPointStaticPart.toLongString(), thisJoinPoint.getArgs());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -21,6 +21,8 @@ import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction; import javax.persistence.EntityTransaction;
import javax.persistence.Query; import javax.persistence.Query;
import org.aspectj.lang.annotation.SuppressAjWarnings;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.orm.jpa.EntityManagerFactoryUtils; import org.springframework.orm.jpa.EntityManagerFactoryUtils;
@ -29,6 +31,7 @@ public aspect JpaExceptionTranslatorAspect {
call(* EntityManager.*(..)) || call(* EntityManagerFactory.*(..)) || call(* EntityManager.*(..)) || call(* EntityManagerFactory.*(..)) ||
call(* EntityTransaction.*(..)) || call(* Query.*(..)); call(* EntityTransaction.*(..)) || call(* Query.*(..));
@SuppressAjWarnings("adviceDidNotMatch")
after() throwing(RuntimeException re): entityManagerCall() { after() throwing(RuntimeException re): entityManagerCall() {
DataAccessException dex = EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(re); DataAccessException dex = EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(re);
if (dex != null) { if (dex != null) {

View File

@ -20,6 +20,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import org.aspectj.lang.annotation.SuppressAjWarnings;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.aop.interceptor.AsyncExecutionAspectSupport; import org.springframework.aop.interceptor.AsyncExecutionAspectSupport;
@ -58,6 +59,7 @@ public abstract aspect AbstractAsyncExecutionAspect extends AsyncExecutionAspect
* @return {@link Future} if the original method returns {@code Future}; {@code null} * @return {@link Future} if the original method returns {@code Future}; {@code null}
* otherwise. * otherwise.
*/ */
@SuppressAjWarnings("adviceDidNotMatch")
Object around() : asyncMethod() { Object around() : asyncMethod() {
final MethodSignature methodSignature = (MethodSignature) thisJoinPointStaticPart.getSignature(); final MethodSignature methodSignature = (MethodSignature) thisJoinPointStaticPart.getSignature();
AsyncTaskExecutor executor = determineAsyncExecutor(methodSignature.getMethod()); AsyncTaskExecutor executor = determineAsyncExecutor(methodSignature.getMethod());