Added @Nullable annotation to overriding methods.

Resolves BATCH-2839
This commit is contained in:
mikeldpl
2019-09-01 15:45:10 +03:00
committed by Mahmoud Ben Hassine
parent 4ec227cd6e
commit a7092a21e4
199 changed files with 726 additions and 259 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2019 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.
@@ -17,6 +17,7 @@
package org.springframework.batch.item.adapter;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.lang.Nullable;
/**
* Invokes a custom method on a delegate plain old Java object which itself
@@ -31,6 +32,7 @@ public class ItemProcessorAdapter<I,O> extends AbstractMethodInvokingDelegator<O
*
* @see ItemProcessor#process(Object)
*/
@Nullable
@Override
public O process(I item) throws Exception {
return invokeDelegateMethodWithArgument(item);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2019 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.
@@ -17,6 +17,7 @@
package org.springframework.batch.item.adapter;
import org.springframework.batch.item.ItemReader;
import org.springframework.lang.Nullable;
/**
* Invokes a custom method on a delegate plain old Java object which itself
@@ -29,6 +30,7 @@ public class ItemReaderAdapter<T> extends AbstractMethodInvokingDelegator<T> imp
/**
* @return return value of the target method.
*/
@Nullable
@Override
public T read() throws Exception {
return invokeDelegateMethod();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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,6 +19,7 @@ package org.springframework.batch.item.amqp;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.Message;
import org.springframework.batch.item.ItemReader;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -45,6 +46,7 @@ public class AmqpItemReader<T> implements ItemReader<T> {
this.amqpTemplate = amqpTemplate;
}
@Nullable
@Override
@SuppressWarnings("unchecked")
public T read() {

View File

@@ -33,6 +33,7 @@ import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -101,6 +102,7 @@ public class AvroItemReader<T> extends AbstractItemCountingItemStreamItemReader<
}
@Nullable
@Override
protected T doRead() throws Exception {
if (this.inputStreamReader != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2019 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.
@@ -18,6 +18,7 @@ package org.springframework.batch.item.data;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import java.util.Iterator;
@@ -53,6 +54,7 @@ AbstractItemCountingItemStreamItemReader<T> {
this.pageSize = pageSize;
}
@Nullable
@Override
protected T doRead() throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012 the original author or authors.
* Copyright 2012-2019 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.
@@ -33,6 +33,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.MethodInvoker;
@@ -150,6 +151,7 @@ public class RepositoryItemReader<T> extends AbstractItemCountingItemStreamItemR
Assert.state(sort != null, "A sort is required");
}
@Nullable
@Override
protected T doRead() throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2018 the original author or authors.
* Copyright 2006-2019 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.
@@ -465,6 +465,7 @@ implements InitializingBean {
* Read next row and map it to item, verify cursor position if
* {@link #setVerifyCursorPosition(boolean)} is true.
*/
@Nullable
@Override
protected T doRead() throws Exception {
if (rs == null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2019 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.
@@ -21,6 +21,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -94,6 +95,7 @@ public abstract class AbstractPagingItemReader<T> extends AbstractItemCountingIt
Assert.isTrue(pageSize > 0, "pageSize must be greater than zero");
}
@Nullable
@Override
protected T doRead() throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2017 the original author or authors.
* Copyright 2006-2019 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.
@@ -27,6 +27,7 @@ import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.database.orm.HibernateQueryProvider;
import org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -150,6 +151,7 @@ public class HibernateCursorItemReader<T> extends AbstractItemCountingItemStream
helper.setUseStatelessSession(useStatelessSession);
}
@Nullable
@Override
protected T doRead() throws Exception {
if (cursor.next()) {

View File

@@ -24,6 +24,7 @@ import java.sql.SQLException;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.support.JdbcUtils;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -134,6 +135,7 @@ public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
}
@Nullable
@Override
protected T readCursor(ResultSet rs, int currentRow) throws SQLException {
return rowMapper.mapRow(rs, currentRow);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2019 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.
@@ -29,6 +29,7 @@ import org.springframework.jdbc.core.SqlOutParameter;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.core.metadata.CallMetaDataContext;
import org.springframework.jdbc.support.JdbcUtils;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -230,6 +231,7 @@ public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> {
}
@Nullable
@Override
protected T readCursor(ResultSet rs, int currentRow) throws SQLException {
return rowMapper.mapRow(rs, currentRow);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2019 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.
@@ -29,6 +29,7 @@ import org.springframework.batch.item.file.separator.SimpleRecordSeparatorPolicy
import org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
@@ -164,6 +165,7 @@ public class FlatFileItemReader<T> extends AbstractItemCountingItemStreamItemRea
* @return string corresponding to logical record according to
* {@link #setRecordSeparatorPolicy(RecordSeparatorPolicy)} (might span multiple lines in file).
*/
@Nullable
@Override
protected T doRead() throws Exception {
if (noInput) {
@@ -189,7 +191,8 @@ public class FlatFileItemReader<T> extends AbstractItemCountingItemStreamItemRea
/**
* @return next line (skip comments).getCurrentResource
*/
private String readLine() {
@Nullable
protected String readLine() {
if (reader == null) {
throw new ReaderNotOpenException("Reader must be open before it can be read.");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2018 the original author or authors.
* Copyright 2006-2019 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.
@@ -92,6 +92,7 @@ public class MultiResourceItemReader<T> extends AbstractItemStreamItemReader<T>
/**
* Reads the next item, jumping to next resource if necessary.
*/
@Nullable
@Override
public T read() throws Exception, UnexpectedInputException, ParseException {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2014 the original author or authors.
* Copyright 2006-2019 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.
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;
/**
@@ -120,7 +121,7 @@ public abstract class AbstractLineTokenizer implements LineTokenizer {
* @return the resulting tokens
*/
@Override
public FieldSet tokenize(String line) {
public FieldSet tokenize(@Nullable String line) {
if (line == null) {
line = "";

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2019 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.
@@ -20,6 +20,7 @@ import java.util.Map;
import org.springframework.batch.support.PatternMatcher;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -46,7 +47,7 @@ public class PatternMatchingCompositeLineTokenizer implements LineTokenizer, Ini
* java.lang.String)
*/
@Override
public FieldSet tokenize(String line) {
public FieldSet tokenize(@Nullable String line) {
return tokenizers.match(line).tokenize(line);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 the original author or authors.
* Copyright 2017-2019 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.
@@ -18,6 +18,7 @@ package org.springframework.batch.item.function;
import java.util.function.Function;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -38,6 +39,7 @@ public class FunctionItemProcessor<I, O> implements ItemProcessor<I, O>{
this.function = function;
}
@Nullable
@Override
public O process(I item) throws Exception {
return this.function.apply(item);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2019 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.
@@ -22,6 +22,7 @@ import org.springframework.batch.item.ItemReader;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.jms.core.JmsOperations;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import javax.jms.Message;
@@ -76,7 +77,8 @@ public class JmsItemReader<T> implements ItemReader<T>, InitializingBean {
this.itemType = itemType;
}
@Override
@Nullable
@Override
@SuppressWarnings("unchecked")
public T read() {
if (itemType != null && itemType.isAssignableFrom(Message.class)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2019 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.
@@ -28,6 +28,7 @@ import com.google.gson.stream.JsonToken;
import org.springframework.batch.item.ParseException;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -76,6 +77,7 @@ public class GsonJsonObjectReader<T> implements JsonObjectReader<T> {
this.jsonReader.beginArray();
}
@Nullable
@Override
public T read() throws Exception {
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2019 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.
@@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.batch.item.ParseException;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -72,6 +73,7 @@ public class JacksonJsonObjectReader<T> implements JsonObjectReader<T> {
"The Json input stream must start with an array of Json objects");
}
@Nullable
@Override
public T read() throws Exception {
try {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2019 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,6 +23,7 @@ import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.file.ResourceAwareItemReaderItemStream;
import org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -94,6 +95,7 @@ public class JsonItemReader<T> extends AbstractItemCountingItemStreamItemReader<
this.resource = resource;
}
@Nullable
@Override
protected T doRead() throws Exception {
return jsonObjectReader.read();

View File

@@ -32,6 +32,7 @@ import org.apache.kafka.common.TopicPartition;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.support.AbstractItemStreamItemReader;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -156,6 +157,7 @@ public class KafkaItemReader<K, V> extends AbstractItemStreamItemReader<V> {
this.partitionOffsets.forEach(this.kafkaConsumer::seek);
}
@Nullable
@Override
public V read() {
if (this.consumerRecords == null || !this.consumerRecords.hasNext()) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2014 the original author or authors.
* Copyright 2005-2019 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.
@@ -22,6 +22,7 @@ import org.springframework.batch.item.file.ResourceAwareItemReaderItemStream;
import org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
import org.springframework.ldap.core.LdapAttributes;
import org.springframework.ldap.ldif.parser.LdifParser;
import org.springframework.util.Assert;
@@ -134,6 +135,7 @@ public class LdifReader extends AbstractItemCountingItemStreamItemReader<LdapAtt
}
}
@Nullable
@Override
protected LdapAttributes doRead() throws Exception {
LdapAttributes attributes = null;
@@ -170,4 +172,4 @@ public class LdifReader extends AbstractItemCountingItemStreamItemReader<LdapAtt
Assert.notNull(ldifParser, "A parser is required");
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2014 the original author or authors.
* Copyright 2005-2019 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.
@@ -21,6 +21,7 @@ import org.springframework.batch.item.file.ResourceAwareItemReaderItemStream;
import org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
import org.springframework.ldap.core.LdapAttributes;
import org.springframework.ldap.ldif.parser.LdifParser;
import org.springframework.util.Assert;
@@ -138,6 +139,7 @@ public class MappingLdifReader<T> extends AbstractItemCountingItemStreamItemRead
}
}
@Nullable
@Override
protected T doRead() throws Exception {
LdapAttributes attributes = null;
@@ -169,4 +171,4 @@ public class MappingLdifReader<T> extends AbstractItemCountingItemStreamItemRead
Assert.notNull(ldifParser, "A parser is required");
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2018 the original author or authors.
* Copyright 2006-2019 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.
@@ -83,6 +83,7 @@ public abstract class AbstractItemCountingItemStreamItemReader<T> extends Abstra
}
}
@Nullable
@Override
public T read() throws Exception, UnexpectedInputException, ParseException {
if (currentItemCount >= maxItemCount) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2019 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,6 +19,7 @@ package org.springframework.batch.item.support;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.classify.Classifier;
import org.springframework.classify.ClassifierSupport;
import org.springframework.lang.Nullable;
/**
* Calls one of a collection of ItemProcessors, based on a router
@@ -47,6 +48,7 @@ public class ClassifierCompositeItemProcessor<I,O> implements ItemProcessor<I, O
* Delegates to injected {@link ItemProcessor} instances according to the
* classification by the {@link Classifier}.
*/
@Nullable
@Override
public O process(I item) throws Exception {
return processItem(classifier.classify(item), item);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2019 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.
@@ -18,6 +18,7 @@ package org.springframework.batch.item.support;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import java.util.List;
@@ -37,6 +38,7 @@ public class CompositeItemProcessor<I, O> implements ItemProcessor<I, O>, Initia
private List<? extends ItemProcessor<?, ?>> delegates;
@Nullable
@Override
@SuppressWarnings("unchecked")
public O process(I item) throws Exception {

View File

@@ -19,6 +19,7 @@ package org.springframework.batch.item.support;
import java.util.Iterator;
import org.springframework.batch.item.ItemReader;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -62,7 +63,8 @@ public class IteratorItemReader<T> implements ItemReader<T> {
* Implementation of {@link ItemReader#read()} that just iterates over the
* iterator provided.
*/
@Override
@Nullable
@Override
public T read() {
if (iterator.hasNext())
return iterator.next();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2019 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.
@@ -21,6 +21,7 @@ import java.util.List;
import org.springframework.aop.support.AopUtils;
import org.springframework.batch.item.ItemReader;
import org.springframework.lang.Nullable;
/**
* An {@link ItemReader} that pulls data from a list. Useful for testing.
@@ -43,7 +44,8 @@ public class ListItemReader<T> implements ItemReader<T> {
}
}
@Override
@Nullable
@Override
public T read() {
if (!list.isEmpty()) {
return list.remove(0);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2019 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.
@@ -17,6 +17,7 @@
package org.springframework.batch.item.support;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.lang.Nullable;
/**
* Simple {@link ItemProcessor} that does nothing - simply passes its argument
@@ -35,7 +36,8 @@ public class PassThroughItemProcessor<T> implements ItemProcessor<T, T> {
* @return the item
* @see ItemProcessor#process(Object)
*/
@Override
@Nullable
@Override
public T process(T item) throws Exception {
return item;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2019 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.
@@ -15,6 +15,7 @@
*/
package org.springframework.batch.item.support;
import org.springframework.lang.Nullable;
import org.springframework.scripting.support.StaticScriptSource;
import org.springframework.util.StringUtils;
import org.springframework.batch.item.ItemProcessor;
@@ -53,6 +54,7 @@ public class ScriptItemProcessor<I, O> implements ItemProcessor<I, O>, Initializ
private ScriptEvaluator scriptEvaluator;
private String itemBindingVariableName = ITEM_BINDING_VARIABLE_NAME;
@Nullable
@Override
@SuppressWarnings("unchecked")
public O process(I item) throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2010 the original author or authors.
* Copyright 2006-2019 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.
@@ -25,6 +25,7 @@ import org.springframework.batch.item.ItemStreamReader;
import org.springframework.batch.item.ParseException;
import org.springframework.batch.item.PeekableItemReader;
import org.springframework.batch.item.UnexpectedInputException;
import org.springframework.lang.Nullable;
/**
* <p>
@@ -66,7 +67,8 @@ public class SingleItemPeekableItemReader<T> implements ItemStreamReader<T>, Pee
*
* @see ItemReader#read()
*/
@Override
@Nullable
@Override
public T read() throws Exception, UnexpectedInputException, ParseException {
if (next != null) {
T item = next;
@@ -86,7 +88,8 @@ public class SingleItemPeekableItemReader<T> implements ItemStreamReader<T>, Pee
*
* @see PeekableItemReader#peek()
*/
@Override
@Nullable
@Override
public T peek() throws Exception, UnexpectedInputException, ParseException {
if (next == null) {
updateDelegate(executionContext);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2019 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.
@@ -21,6 +21,7 @@ import org.springframework.batch.item.NonTransientResourceException;
import org.springframework.batch.item.ParseException;
import org.springframework.batch.item.UnexpectedInputException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -51,6 +52,7 @@ public class SynchronizedItemStreamReader<T> implements ItemStreamReader<T>, Ini
/**
* This delegates to the read method of the <code>delegate</code>
*/
@Nullable
public synchronized T read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
return this.delegate.read();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2019 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.
@@ -17,6 +17,7 @@ package org.springframework.batch.item.validator;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -76,7 +77,8 @@ public class ValidatingItemProcessor<T> implements ItemProcessor<T, T>, Initiali
* @return the input item
* @throws ValidationException if validation fails
*/
@Override
@Nullable
@Override
public T process(T item) throws ValidationException {
try {
validator.validate(item);

View File

@@ -39,6 +39,7 @@ import org.springframework.batch.item.xml.stax.DefaultFragmentEventReader;
import org.springframework.batch.item.xml.stax.FragmentEventReader;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
import org.springframework.lang.Nullable;
import org.springframework.oxm.Unmarshaller;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -229,6 +230,7 @@ ResourceAwareItemReaderItemStream<T>, InitializingBean {
/**
* Move to next fragment and map it to item.
*/
@Nullable
@Override
protected T doRead() throws IOException, XMLStreamException {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2019 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.
@@ -17,6 +17,7 @@ package org.springframework.batch.jsr.item;
import javax.batch.api.chunk.ItemProcessor;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
public class ItemProcessorAdapter<I, O> implements org.springframework.batch.item.ItemProcessor<I, O> {
@@ -28,6 +29,7 @@ public class ItemProcessorAdapter<I, O> implements org.springframework.batch.ite
this.delegate = processor;
}
@Nullable
@SuppressWarnings("unchecked")
@Override
public O process(I item) throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2019 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,6 +19,7 @@ import java.io.Serializable;
import javax.batch.api.chunk.ItemReader;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -48,6 +49,7 @@ public class ItemReaderAdapter<T> extends CheckpointSupport implements org.sprin
/* (non-Javadoc)
* @see org.springframework.batch.item.ItemReader#read()
*/
@Nullable
@SuppressWarnings("unchecked")
@Override
public T read() throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2019 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.
@@ -24,6 +24,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.springframework.aop.support.AopUtils;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
@@ -66,7 +67,8 @@ public class AnnotationMethodResolver implements MethodResolver {
* @throws IllegalArgumentException if more than one Method has the
* specified annotation
*/
@Override
@Nullable
@Override
public Method findMethod(Object candidate) {
Assert.notNull(candidate, "candidate object must not be null");
Class<?> targetClass = AopUtils.getTargetClass(candidate);
@@ -88,7 +90,8 @@ public class AnnotationMethodResolver implements MethodResolver {
* @throws IllegalArgumentException if more than one Method has the
* specified annotation
*/
@Override
@Nullable
@Override
public Method findMethod(final Class<?> clazz) {
Assert.notNull(clazz, "class must not be null");
final AtomicReference<Method> annotatedMethod = new AtomicReference<>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2019 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.
@@ -35,6 +35,7 @@ import java.lang.reflect.Method;
import java.util.Arrays;
import org.springframework.aop.framework.Advised;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -81,7 +82,8 @@ public class SimpleMethodInvoker implements MethodInvoker {
* org.springframework.batch.core.configuration.util.MethodInvoker#invokeMethod
* (java.lang.Object[])
*/
@Override
@Nullable
@Override
public Object invokeMethod(Object... args) {
Class<?>[] parameterTypes = method.getParameterTypes();