提交 d0502e4f 编写于 作者: S Stephan Ewen

[FLINK-2638] [core] Add @SafeVarargs to the ExecutionEnvironment's "fromElements(...)" method.

This closes #1109
上级 95d035ab
......@@ -703,7 +703,8 @@ public abstract class ExecutionEnvironment {
* @param data The elements to make up the data set.
* @return A DataSet representing the given list of elements.
*/
public <X> DataSource<X> fromElements(X... data) {
@SafeVarargs
public final <X> DataSource<X> fromElements(X... data) {
if (data == null) {
throw new IllegalArgumentException("The data must not be null.");
}
......
......@@ -553,7 +553,8 @@ public abstract class StreamExecutionEnvironment {
* The type of the returned data stream
* @return The data stream representing the given array of elements
*/
public <OUT> DataStreamSource<OUT> fromElements(OUT... data) {
@SafeVarargs
public final <OUT> DataStreamSource<OUT> fromElements(OUT... data) {
if (data.length == 0) {
throw new IllegalArgumentException("fromElements needs at least one element as argument");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册