Add @Override annotations to test sources
Issue: SPR-10129
This commit is contained in:
@@ -207,6 +207,7 @@ class NeverMatchAdvisor extends StaticMethodMatcherPointcutAdvisor {
|
||||
/**
|
||||
* @see org.springframework.aop.MethodMatcher#matches(java.lang.reflect.Method, java.lang.Class)
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
return false;
|
||||
}
|
||||
@@ -249,10 +250,12 @@ class OrderedTxCheckAdvisor extends StaticMethodMatcherPointcutAdvisor implement
|
||||
return (CountingBeforeAdvice) getAdvice();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
setAdvice(new TxCountingBeforeAdvice());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return method.getName().startsWith("setAge");
|
||||
}
|
||||
@@ -260,6 +263,7 @@ class OrderedTxCheckAdvisor extends StaticMethodMatcherPointcutAdvisor implement
|
||||
|
||||
private class TxCountingBeforeAdvice extends CountingBeforeAdvice {
|
||||
|
||||
@Override
|
||||
public void before(Method method, Object[] args, Object target) throws Throwable {
|
||||
// do transaction checks
|
||||
if (requireTransactionContext) {
|
||||
@@ -323,21 +327,25 @@ class CallCountingTransactionManager extends AbstractPlatformTransactionManager
|
||||
public int rollbacks;
|
||||
public int inflight;
|
||||
|
||||
@Override
|
||||
protected Object doGetTransaction() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doBegin(Object transaction, TransactionDefinition definition) {
|
||||
this.lastDefinition = definition;
|
||||
++begun;
|
||||
++inflight;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCommit(DefaultTransactionStatus status) {
|
||||
++commits;
|
||||
--inflight;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRollback(DefaultTransactionStatus status) {
|
||||
++rollbacks;
|
||||
--inflight;
|
||||
|
||||
@@ -121,6 +121,7 @@ public class EnableCachingIntegrationTests {
|
||||
@Repository
|
||||
static class DummyFooRepository implements FooRepository {
|
||||
|
||||
@Override
|
||||
@Cacheable("primary")
|
||||
public List<Object> findAll() {
|
||||
return Collections.emptyList();
|
||||
|
||||
@@ -300,6 +300,7 @@ public class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
|
||||
scanner.setIncludeAnnotationConfig(false);
|
||||
scanner.setScopeMetadataResolver(new ScopeMetadataResolver() {
|
||||
@Override
|
||||
public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
|
||||
ScopeMetadata metadata = new ScopeMetadata();
|
||||
if (definition instanceof AnnotatedBeanDefinition) {
|
||||
@@ -345,8 +346,10 @@ public class ClassPathBeanDefinitionScannerJsr330ScopeIntegrationTests {
|
||||
|
||||
private String name = DEFAULT_NAME;
|
||||
|
||||
@Override
|
||||
public String getName() { return this.name; }
|
||||
|
||||
@Override
|
||||
public void setName(String name) { this.name = name; }
|
||||
}
|
||||
|
||||
|
||||
@@ -284,6 +284,7 @@ public class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
|
||||
scanner.setIncludeAnnotationConfig(false);
|
||||
scanner.setBeanNameGenerator(new BeanNameGenerator() {
|
||||
@Override
|
||||
public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
|
||||
return definition.getScope();
|
||||
}
|
||||
@@ -311,8 +312,10 @@ public class ClassPathBeanDefinitionScannerScopeIntegrationTests {
|
||||
|
||||
private String name = DEFAULT_NAME;
|
||||
|
||||
@Override
|
||||
public String getName() { return this.name; }
|
||||
|
||||
@Override
|
||||
public void setName(String name) { this.name = name; }
|
||||
}
|
||||
|
||||
|
||||
@@ -656,6 +656,7 @@ public class EnvironmentIntegrationTests {
|
||||
|
||||
public Environment environment;
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Environment environment) {
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
if (beanFactory instanceof ConfigurableBeanFactory) {
|
||||
Object typeConverter = ((ConfigurableBeanFactory) beanFactory).getTypeConverter();
|
||||
@@ -80,6 +81,7 @@ class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware {
|
||||
return delegate.findCustomEditor(targetType, null) != null || delegate.getDefaultEditor(targetType) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConvert(TypeDescriptor sourceTypeDescriptor, TypeDescriptor targetTypeDescriptor) {
|
||||
if (conversionService.canConvert(sourceTypeDescriptor, targetTypeDescriptor)) {
|
||||
return true;
|
||||
@@ -90,6 +92,7 @@ class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware {
|
||||
return canConvert(sourceType, targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
if (targetType.getType() == Void.class || targetType.getType() == Void.TYPE) {
|
||||
return null;
|
||||
|
||||
@@ -153,6 +153,7 @@ public class ScheduledAndTransactionalAnnotationIntegrationTests {
|
||||
this.count.incrementAndGet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvocationCount() {
|
||||
return this.count.get();
|
||||
}
|
||||
@@ -168,12 +169,14 @@ public class ScheduledAndTransactionalAnnotationIntegrationTests {
|
||||
|
||||
private final AtomicInteger count = new AtomicInteger(0);
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Scheduled(fixedDelay = 5)
|
||||
public void scheduled() {
|
||||
this.count.incrementAndGet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvocationCount() {
|
||||
return this.count.get();
|
||||
}
|
||||
|
||||
@@ -33,21 +33,25 @@ public class CallCountingTransactionManager extends AbstractPlatformTransactionM
|
||||
public int rollbacks;
|
||||
public int inflight;
|
||||
|
||||
@Override
|
||||
protected Object doGetTransaction() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doBegin(Object transaction, TransactionDefinition definition) {
|
||||
this.lastDefinition = definition;
|
||||
++begun;
|
||||
++inflight;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCommit(DefaultTransactionStatus status) {
|
||||
++commits;
|
||||
--inflight;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRollback(DefaultTransactionStatus status) {
|
||||
++rollbacks;
|
||||
--inflight;
|
||||
|
||||
@@ -219,6 +219,7 @@ public class EnableTransactionManagementIntegrationTests {
|
||||
return new CallCountingTransactionManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
||||
return txManager1();
|
||||
}
|
||||
@@ -327,6 +328,7 @@ public class EnableTransactionManagementIntegrationTests {
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<Object> findAll() {
|
||||
return Collections.emptyList();
|
||||
@@ -336,6 +338,7 @@ public class EnableTransactionManagementIntegrationTests {
|
||||
@Repository
|
||||
static class DummyFooRepository implements FooRepository {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<Object> findAll() {
|
||||
return Collections.emptyList();
|
||||
|
||||
@@ -115,10 +115,12 @@ interface AnnotatedService {
|
||||
}
|
||||
|
||||
class NonAnnotatedServiceImpl implements AnnotatedService {
|
||||
@Override
|
||||
public void m() { }
|
||||
}
|
||||
|
||||
class AnnotatedServiceImpl implements NonAnnotatedService {
|
||||
@Override
|
||||
@Transactional public void m() { }
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.aop.AfterReturningAdvice;
|
||||
@SuppressWarnings("serial")
|
||||
public class CountingAfterReturningAdvice extends MethodCounter implements AfterReturningAdvice {
|
||||
|
||||
@Override
|
||||
public void afterReturning(Object o, Method m, Object[] args, Object target) throws Throwable {
|
||||
count(m);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.aop.MethodBeforeAdvice;
|
||||
@SuppressWarnings("serial")
|
||||
public class CountingBeforeAdvice extends MethodCounter implements MethodBeforeAdvice {
|
||||
|
||||
@Override
|
||||
public void before(Method m, Object[] args, Object target) throws Throwable {
|
||||
count(m);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public class NestedTestBean implements INestedTestBean {
|
||||
this.company = (company != null ? company : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCompany() {
|
||||
return company;
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
@@ -145,6 +146,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
return beanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
@@ -161,10 +163,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
return postProcessed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@@ -180,10 +184,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
@@ -196,14 +202,17 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
this.jedi = jedi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITestBean getSpouse() {
|
||||
return (spouses != null ? spouses[0] : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpouse(ITestBean spouse) {
|
||||
this.spouses = new ITestBean[] {spouse};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITestBean[] getSpouses() {
|
||||
return spouses;
|
||||
}
|
||||
@@ -230,10 +239,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStringArray() {
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStringArray(String[] stringArray) {
|
||||
this.stringArray = stringArray;
|
||||
}
|
||||
@@ -302,6 +313,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
this.someProperties = someProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public INestedTestBean getDoctor() {
|
||||
return doctor;
|
||||
}
|
||||
@@ -310,6 +322,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
this.doctor = doctor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public INestedTestBean getLawyer() {
|
||||
return lawyer;
|
||||
}
|
||||
@@ -342,6 +355,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
this.someBoolean = someBoolean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndexedTestBean getNestedIndexedBean() {
|
||||
return nestedIndexedBean;
|
||||
}
|
||||
@@ -370,18 +384,21 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
/**
|
||||
* @see ITestBean#exceptional(Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void exceptional(Throwable t) throws Throwable {
|
||||
if (t != null) {
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unreliableFileOperation() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
/**
|
||||
* @see ITestBean#returnsThis()
|
||||
*/
|
||||
@Override
|
||||
public Object returnsThis() {
|
||||
return this;
|
||||
}
|
||||
@@ -389,9 +406,11 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
/**
|
||||
* @see IOther#absquatulate()
|
||||
*/
|
||||
@Override
|
||||
public void absquatulate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int haveBirthday() {
|
||||
return age++;
|
||||
}
|
||||
@@ -421,6 +440,7 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
return this.age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object other) {
|
||||
if (this.name != null && other instanceof TestBean) {
|
||||
return this.name.compareTo(((TestBean) other).getName());
|
||||
|
||||
@@ -32,6 +32,7 @@ public class NopInterceptor implements MethodInterceptor {
|
||||
/**
|
||||
* @see org.aopalliance.intercept.MethodInterceptor#invoke(MethodInvocation)
|
||||
*/
|
||||
@Override
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
increment();
|
||||
return invocation.proceed();
|
||||
|
||||
@@ -35,10 +35,12 @@ public class SerializableNopInterceptor extends NopInterceptor implements Serial
|
||||
*/
|
||||
private int count;
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void increment() {
|
||||
++count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user