Add missing @Override annotations

This commit is contained in:
Sam Brannen
2019-08-22 14:48:08 +02:00
parent 0b63db26b7
commit ad6231ad29
108 changed files with 321 additions and 0 deletions

View File

@@ -78,6 +78,7 @@ public class CacheEvictOperation extends CacheOperation {
return sb;
}
@Override
public CacheEvictOperation build() {
return new CacheEvictOperation(this);
}

View File

@@ -70,6 +70,7 @@ public class CachePutOperation extends CacheOperation {
return sb;
}
@Override
public CachePutOperation build() {
return new CachePutOperation(this);
}

View File

@@ -152,6 +152,7 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex
* @see #scan(String...)
* @see #refresh()
*/
@Override
public void register(Class<?>... annotatedClasses) {
Assert.notEmpty(annotatedClasses, "At least one annotated class must be specified");
this.reader.register(annotatedClasses);
@@ -165,6 +166,7 @@ public class AnnotationConfigApplicationContext extends GenericApplicationContex
* @see #register(Class...)
* @see #refresh()
*/
@Override
public void scan(String... basePackages) {
Assert.notEmpty(basePackages, "At least one base package must be specified");
this.scanner.scan(basePackages);

View File

@@ -45,6 +45,7 @@ public class DefaultEventListenerFactory implements EventListenerFactory, Ordere
}
@Override
public boolean supportsMethod(Method method) {
return true;
}

View File

@@ -225,18 +225,22 @@ public class GenericGroovyApplicationContext extends GenericApplicationContext i
// Implementation of the GroovyObject interface
@Override
public void setMetaClass(MetaClass metaClass) {
this.metaClass = metaClass;
}
@Override
public MetaClass getMetaClass() {
return this.metaClass;
}
@Override
public Object invokeMethod(String name, Object args) {
return this.metaClass.invokeMethod(this, name, args);
}
@Override
public void setProperty(String property, Object newValue) {
if (newValue instanceof BeanDefinition) {
registerBeanDefinition(property, (BeanDefinition) newValue);
@@ -246,6 +250,7 @@ public class GenericGroovyApplicationContext extends GenericApplicationContext i
}
}
@Override
@Nullable
public Object getProperty(String property) {
if (containsBean(property)) {

View File

@@ -88,6 +88,7 @@ public class ConcurrentModel extends ConcurrentHashMap<String, Object> implement
* @param attributeValue the model attribute value (ignored if {@code null},
* just removing an existing entry if any)
*/
@Override
public ConcurrentModel addAttribute(String attributeName, @Nullable Object attributeValue) {
Assert.notNull(attributeName, "Model attribute name must not be null");
put(attributeName, attributeValue);
@@ -103,6 +104,7 @@ public class ConcurrentModel extends ConcurrentHashMap<String, Object> implement
* than for empty collections as is already done by JSTL tags.</i>
* @param attributeValue the model attribute value (never {@code null})
*/
@Override
public ConcurrentModel addAttribute(Object attributeValue) {
Assert.notNull(attributeValue, "Model attribute value must not be null");
if (attributeValue instanceof Collection && ((Collection<?>) attributeValue).isEmpty()) {
@@ -116,6 +118,7 @@ public class ConcurrentModel extends ConcurrentHashMap<String, Object> implement
* {@code Map}, using attribute name generation for each element.
* @see #addAttribute(Object)
*/
@Override
public ConcurrentModel addAllAttributes(@Nullable Collection<?> attributeValues) {
if (attributeValues != null) {
for (Object attributeValue : attributeValues) {
@@ -129,6 +132,7 @@ public class ConcurrentModel extends ConcurrentHashMap<String, Object> implement
* Copy all attributes in the supplied {@code Map} into this {@code Map}.
* @see #addAttribute(String, Object)
*/
@Override
public ConcurrentModel addAllAttributes(@Nullable Map<String, ?> attributes) {
if (attributes != null) {
putAll(attributes);
@@ -141,6 +145,7 @@ public class ConcurrentModel extends ConcurrentHashMap<String, Object> implement
* with existing objects of the same name taking precedence (i.e. not getting
* replaced).
*/
@Override
public ConcurrentModel mergeAttributes(@Nullable Map<String, ?> attributes) {
if (attributes != null) {
attributes.forEach((key, value) -> {
@@ -157,6 +162,7 @@ public class ConcurrentModel extends ConcurrentHashMap<String, Object> implement
* @param attributeName the name of the model attribute (never {@code null})
* @return whether this model contains a corresponding attribute
*/
@Override
public boolean containsAttribute(String attributeName) {
return containsKey(attributeName);
}

View File

@@ -414,6 +414,7 @@ public class LocalValidatorFactoryBean extends SpringValidatorAdapter
throw new ValidationException("Cannot unwrap to " + type);
}
@Override
public void close() {
if (this.validatorFactory != null) {
this.validatorFactory.close();

View File

@@ -57,6 +57,7 @@ public class SpringConstraintValidatorFactory implements ConstraintValidatorFact
}
// Bean Validation 1.1 releaseInstance method
@Override
public void releaseInstance(ConstraintValidator<?, ?> instance) {
this.beanFactory.destroyBean(instance);
}

View File

@@ -1003,22 +1003,27 @@ class TestScope implements Scope {
int instanceCount
@Override
public Object remove(String name) {
// do nothing
}
@Override
public void registerDestructionCallback(String name, Runnable callback) {
}
@Override
public String getConversationId() {
return "mock"
}
@Override
public Object get(String name, ObjectFactory<?> objectFactory) {
instanceCount++
objectFactory.getObject()
}
@Override
public Object resolveContextualObject(String s) {
return null; // noop
}

View File

@@ -183,6 +183,7 @@ public class CacheErrorHandlerTests {
return new SimpleService();
}
@Override
@Bean
public CacheManager cacheManager() {
SimpleCacheManager cacheManager = new SimpleCacheManager();

View File

@@ -1281,6 +1281,7 @@ public class ConfigurationClassPostProcessorTests {
public interface RepositoryInterface<T> {
@Override
String toString();
}

View File

@@ -167,6 +167,7 @@ public class LazyAutowiredAnnotationBeanPostProcessorTests {
@Autowired @Lazy
private List<TestBean> testBeans;
@Override
public TestBean getTestBean() {
return this.testBean;
}
@@ -185,6 +186,7 @@ public class LazyAutowiredAnnotationBeanPostProcessorTests {
@Autowired(required = false) @Lazy
private List<TestBean> testBeans;
@Override
public TestBean getTestBean() {
return this.testBean;
}
@@ -200,6 +202,7 @@ public class LazyAutowiredAnnotationBeanPostProcessorTests {
@LazyInject
private TestBean testBean;
@Override
public TestBean getTestBean() {
return this.testBean;
}
@@ -218,6 +221,7 @@ public class LazyAutowiredAnnotationBeanPostProcessorTests {
this.testBean = testBean;
}
@Override
public TestBean getTestBean() {
return this.testBean;
}
@@ -236,6 +240,7 @@ public class LazyAutowiredAnnotationBeanPostProcessorTests {
this.testBean = testBean;
}
@Override
public TestBean getTestBean() {
return this.testBean;
}
@@ -254,6 +259,7 @@ public class LazyAutowiredAnnotationBeanPostProcessorTests {
this.testBean = testBean;
}
@Override
public TestBean getTestBean() {
return this.testBean;
}
@@ -269,6 +275,7 @@ public class LazyAutowiredAnnotationBeanPostProcessorTests {
this.testBean = testBean;
}
@Override
public TestBean getTestBean() {
return this.testBean;
}
@@ -284,6 +291,7 @@ public class LazyAutowiredAnnotationBeanPostProcessorTests {
this.testBean = testBean;
}
@Override
public TestBean getTestBean() {
return this.testBean;
}
@@ -299,6 +307,7 @@ public class LazyAutowiredAnnotationBeanPostProcessorTests {
this.testBean = testBean;
}
@Override
public TestBean getTestBean() {
return this.testBean;
}

View File

@@ -361,6 +361,7 @@ public class ConfigurationClassProcessingTests {
static TestBean testBean = new TestBean(ConfigWithBeanWithProviderImplementation.class.getSimpleName());
@Override
@Bean(name = "customName")
public TestBean get() {
return testBean;
@@ -373,6 +374,7 @@ public class ConfigurationClassProcessingTests {
static Set<String> set = Collections.singleton("value");
@Override
@Bean(name = "customName")
public Set<String> get() {
return set;

View File

@@ -42,6 +42,7 @@ public class ScannedComponent {
@Scope(proxyMode = ScopedProxyMode.INTERFACES, value = "prototype")
public static class StateImpl implements State {
@Override
public String anyMethod() {
return "anyMethod called";
}

View File

@@ -840,6 +840,7 @@ public class AnnotationDrivenEventListenerTests {
this.eventCollector.addEvent(this, event);
}
@Override
@EventListener
@Async
public void handleAsync(AnotherTestEvent event) {
@@ -866,6 +867,7 @@ public class AnnotationDrivenEventListenerTests {
this.eventCollector.addEvent(this, event);
}
@Override
@EventListener
@Async
public void handleAsync(AnotherTestEvent event) {
@@ -988,11 +990,13 @@ public class AnnotationDrivenEventListenerTests {
super.handleString(payload);
}
@Override
@ConditionalEvent("#root.event.timestamp > #p0")
public void handleTimestamp(Long timestamp) {
collectEvent(timestamp);
}
@Override
@ConditionalEvent("@conditionEvaluator.valid(#p0)")
public void handleRatio(Double ratio) {
collectEvent(ratio);

View File

@@ -633,6 +633,7 @@ public class ApplicationContextEventTests extends AbstractApplicationEventListen
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}

View File

@@ -77,14 +77,17 @@ public class FactoryBeanAccessTests {
static class CarFactoryBean implements FactoryBean<Car> {
@Override
public Car getObject() {
return new Car();
}
@Override
public Class<Car> getObjectType() {
return Car.class;
}
@Override
public boolean isSingleton() {
return false;
}

View File

@@ -565,11 +565,13 @@ public class AsyncExecutionTests {
@Async
public static class AsyncClassBeanWithInterface implements RegularInterface {
@Override
public void doSomething(int i) {
boolean condition = !Thread.currentThread().getName().equals(originalThreadName);
assertThat(condition).isTrue();
}
@Override
public Future<String> returnSomething(int i) {
boolean condition = !Thread.currentThread().getName().equals(originalThreadName);
assertThat(condition).isTrue();

View File

@@ -322,12 +322,14 @@ public class SpringValidatorAdapterTests {
private String message;
@Override
public void initialize(Same constraintAnnotation) {
field = constraintAnnotation.field();
comparingField = constraintAnnotation.comparingField();
message = constraintAnnotation.message();
}
@Override
public boolean isValid(Object value, ConstraintValidatorContext context) {
BeanWrapper beanWrapper = new BeanWrapperImpl(value);
Object fieldValue = beanWrapper.getPropertyValue(field);

View File

@@ -4,6 +4,7 @@ import org.springframework.scripting.Calculator
class GroovyCalculator implements Calculator {
@Override
int add(int x, int y) {
return x + y;
}

View File

@@ -10,10 +10,12 @@ class GroovyCallCounter implements CallCounter {
count = 0;
}
@Override
void before() {
count++;
}
@Override
int getCalls() {
return count;
}

View File

@@ -6,6 +6,7 @@ class DelegatingCalculator implements Calculator {
def Calculator delegate;
@Override
int add(int x, int y) {
//println "hello"
//println this.metaClass.getClass()

View File

@@ -9,10 +9,12 @@ class GroovyScriptBean implements ContextScriptBean, ApplicationContextAware {
private int age
@Override
int getAge() {
return this.age
}
@Override
void setAge(int age) {
this.age = age
}

View File

@@ -4,14 +4,17 @@ import org.springframework.beans.factory.FactoryBean
class TestFactoryBean implements FactoryBean {
@Override
public boolean isSingleton() {
true
}
@Override
public Class getObjectType() {
String.class
}
@Override
public Object getObject() {
"test"
}