Repository: flink Updated Branches: refs/heads/master 8c042e378 -> f3a519712
[hotfix] [core] Make State Descriptors consistently use Preconditions instead of Objects. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/87dcc890 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/87dcc890 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/87dcc890 Branch: refs/heads/master Commit: 87dcc890ffd1e52872129a2ec6c40668fd7e7184 Parents: 13ef4e4 Author: Stephan Ewen <[email protected]> Authored: Tue Mar 20 15:44:27 2018 +0100 Committer: Stephan Ewen <[email protected]> Committed: Thu Mar 22 15:42:34 2018 +0100 ---------------------------------------------------------------------- .../api/common/state/ReducingStateDescriptor.java | 8 ++++---- .../flink/api/common/state/StateDescriptor.java | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/87dcc890/flink-core/src/main/java/org/apache/flink/api/common/state/ReducingStateDescriptor.java ---------------------------------------------------------------------- diff --git a/flink-core/src/main/java/org/apache/flink/api/common/state/ReducingStateDescriptor.java b/flink-core/src/main/java/org/apache/flink/api/common/state/ReducingStateDescriptor.java index a14b4bd..ef483e2 100644 --- a/flink-core/src/main/java/org/apache/flink/api/common/state/ReducingStateDescriptor.java +++ b/flink-core/src/main/java/org/apache/flink/api/common/state/ReducingStateDescriptor.java @@ -24,7 +24,7 @@ import org.apache.flink.api.common.functions.RichFunction; import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.common.typeutils.TypeSerializer; -import static java.util.Objects.requireNonNull; +import static org.apache.flink.util.Preconditions.checkNotNull; /** * {@link StateDescriptor} for {@link ReducingState}. This can be used to create partitioned @@ -52,7 +52,7 @@ public class ReducingStateDescriptor<T> extends StateDescriptor<ReducingState<T> */ public ReducingStateDescriptor(String name, ReduceFunction<T> reduceFunction, Class<T> typeClass) { super(name, typeClass, null); - this.reduceFunction = requireNonNull(reduceFunction); + this.reduceFunction = checkNotNull(reduceFunction); if (reduceFunction instanceof RichFunction) { throw new UnsupportedOperationException("ReduceFunction of ReducingState can not be a RichFunction."); @@ -68,7 +68,7 @@ public class ReducingStateDescriptor<T> extends StateDescriptor<ReducingState<T> */ public ReducingStateDescriptor(String name, ReduceFunction<T> reduceFunction, TypeInformation<T> typeInfo) { super(name, typeInfo, null); - this.reduceFunction = requireNonNull(reduceFunction); + this.reduceFunction = checkNotNull(reduceFunction); } /** @@ -80,7 +80,7 @@ public class ReducingStateDescriptor<T> extends StateDescriptor<ReducingState<T> */ public ReducingStateDescriptor(String name, ReduceFunction<T> reduceFunction, TypeSerializer<T> typeSerializer) { super(name, typeSerializer, null); - this.reduceFunction = requireNonNull(reduceFunction); + this.reduceFunction = checkNotNull(reduceFunction); } // ------------------------------------------------------------------------ http://git-wip-us.apache.org/repos/asf/flink/blob/87dcc890/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java ---------------------------------------------------------------------- diff --git a/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java b/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java index 841f710..5ec59e4 100644 --- a/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java +++ b/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java @@ -34,7 +34,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import static java.util.Objects.requireNonNull; +import static org.apache.flink.util.Preconditions.checkNotNull; /** * Base class for state descriptors. A {@code StateDescriptor} is used for creating partitioned @@ -100,8 +100,8 @@ public abstract class StateDescriptor<S extends State, T> implements Serializabl * a value before. */ protected StateDescriptor(String name, TypeSerializer<T> serializer, T defaultValue) { - this.name = requireNonNull(name, "name must not be null"); - this.serializer = requireNonNull(serializer, "serializer must not be null"); + this.name = checkNotNull(name, "name must not be null"); + this.serializer = checkNotNull(serializer, "serializer must not be null"); this.defaultValue = defaultValue; } @@ -114,8 +114,8 @@ public abstract class StateDescriptor<S extends State, T> implements Serializabl * a value before. */ protected StateDescriptor(String name, TypeInformation<T> typeInfo, T defaultValue) { - this.name = requireNonNull(name, "name must not be null"); - this.typeInfo = requireNonNull(typeInfo, "type information must not be null"); + this.name = checkNotNull(name, "name must not be null"); + this.typeInfo = checkNotNull(typeInfo, "type information must not be null"); this.defaultValue = defaultValue; } @@ -131,8 +131,8 @@ public abstract class StateDescriptor<S extends State, T> implements Serializabl * a value before. */ protected StateDescriptor(String name, Class<T> type, T defaultValue) { - this.name = requireNonNull(name, "name must not be null"); - requireNonNull(type, "type class must not be null"); + this.name = checkNotNull(name, "name must not be null"); + checkNotNull(type, "type class must not be null"); try { this.typeInfo = TypeExtractor.createTypeInfo(type);
