From f186446d015f3fb676012ff416fde64808449250 Mon Sep 17 00:00:00 2001
From: Gabor Gevay
Date: Fri, 26 Feb 2016 16:09:56 +0100
Subject: [PATCH] [FLINK-3519] [core] Add warning about subclasses to Tuple
JavaDocs.
- Bring TupleGenerator up to date with the Tuple classes.
This closes #1724
---
.../apache/flink/api/java/tuple/Tuple1.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple10.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple11.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple12.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple13.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple14.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple15.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple16.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple17.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple18.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple19.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple2.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple20.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple21.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple22.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple23.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple24.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple25.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple3.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple4.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple5.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple6.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple7.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple8.java | 13 +++++++++---
.../apache/flink/api/java/tuple/Tuple9.java | 13 +++++++++---
.../flink/api/java/tuple/TupleGenerator.java | 21 ++++++++++++-------
26 files changed, 264 insertions(+), 82 deletions(-)
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple1.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple1.java
index 9c81070f12a..b20ffd1c1a1 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple1.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple1.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 1 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple1, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple1", then don't use instances of
+ * Foo in a DataStream<Tuple1> / DataSet<Tuple1>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple10.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple10.java
index 5f8c0626335..7366c9dce4c 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple10.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple10.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 10 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple10, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple10", then don't use instances of
+ * Foo in a DataStream<Tuple10> / DataSet<Tuple10>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple11.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple11.java
index 6f366274274..cc4a9ebf29c 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple11.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple11.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 11 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple11, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple11", then don't use instances of
+ * Foo in a DataStream<Tuple11> / DataSet<Tuple11>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java
index 9fb8d78d8c2..671be97b1e7 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 12 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple12, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple12", then don't use instances of
+ * Foo in a DataStream<Tuple12> / DataSet<Tuple12>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple13.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple13.java
index b8ca79002ed..181f0f3c8da 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple13.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple13.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 13 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple13, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple13", then don't use instances of
+ * Foo in a DataStream<Tuple13> / DataSet<Tuple13>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple14.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple14.java
index 64b9fe3bd0d..eaefc6890d6 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple14.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple14.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 14 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple14, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple14", then don't use instances of
+ * Foo in a DataStream<Tuple14> / DataSet<Tuple14>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple15.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple15.java
index 9ce3b25891b..73cb3e48d00 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple15.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple15.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 15 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple15, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple15", then don't use instances of
+ * Foo in a DataStream<Tuple15> / DataSet<Tuple15>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple16.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple16.java
index b8ba1a62a17..aa2804fee21 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple16.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple16.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 16 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple16, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple16", then don't use instances of
+ * Foo in a DataStream<Tuple16> / DataSet<Tuple16>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple17.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple17.java
index 20d852b47c7..b9e085558d0 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple17.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple17.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 17 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple17, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple17", then don't use instances of
+ * Foo in a DataStream<Tuple17> / DataSet<Tuple17>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple18.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple18.java
index 5885894473d..d1009e9cc0e 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple18.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple18.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 18 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple18, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple18", then don't use instances of
+ * Foo in a DataStream<Tuple18> / DataSet<Tuple18>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple19.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple19.java
index 21f36c0ba5d..f35d1312142 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple19.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple19.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 19 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple19, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple19", then don't use instances of
+ * Foo in a DataStream<Tuple19> / DataSet<Tuple19>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple2.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple2.java
index dc65761c6c6..76c4d64af4c 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple2.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple2.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 2 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple2, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple2", then don't use instances of
+ * Foo in a DataStream<Tuple2> / DataSet<Tuple2>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple20.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple20.java
index 70465205b67..1ca5a509615 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple20.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple20.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 20 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple20, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple20", then don't use instances of
+ * Foo in a DataStream<Tuple20> / DataSet<Tuple20>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple21.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple21.java
index a826a526715..e3cbe48baba 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple21.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple21.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 21 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple21, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple21", then don't use instances of
+ * Foo in a DataStream<Tuple21> / DataSet<Tuple21>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple22.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple22.java
index 05025113a53..67407b899e5 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple22.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple22.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 22 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple22, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple22", then don't use instances of
+ * Foo in a DataStream<Tuple22> / DataSet<Tuple22>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple23.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple23.java
index 23c036e6977..2c682e83407 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple23.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple23.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 23 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple23, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple23", then don't use instances of
+ * Foo in a DataStream<Tuple23> / DataSet<Tuple23>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple24.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple24.java
index d18d1d4ab25..e1964a091fc 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple24.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple24.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 24 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple24, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple24", then don't use instances of
+ * Foo in a DataStream<Tuple24> / DataSet<Tuple24>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple25.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple25.java
index 81748249f74..ed432722b25 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple25.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple25.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 25 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple25, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple25", then don't use instances of
+ * Foo in a DataStream<Tuple25> / DataSet<Tuple25>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple3.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple3.java
index 27e19ef020e..0b479e537c6 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple3.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple3.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 3 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple3, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple3", then don't use instances of
+ * Foo in a DataStream<Tuple3> / DataSet<Tuple3>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple4.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple4.java
index 61e4076a2d0..5c4bdf7a013 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple4.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple4.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 4 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple4, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple4", then don't use instances of
+ * Foo in a DataStream<Tuple4> / DataSet<Tuple4>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple5.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple5.java
index 259db12ad51..b039728ae5d 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple5.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple5.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 5 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple5, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple5", then don't use instances of
+ * Foo in a DataStream<Tuple5> / DataSet<Tuple5>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple6.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple6.java
index f0dc9d9d5b4..3e57277584e 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple6.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple6.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 6 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple6, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple6", then don't use instances of
+ * Foo in a DataStream<Tuple6> / DataSet<Tuple6>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java
index 9e0b8daf85b..a95ff12e948 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 7 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple7, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple7", then don't use instances of
+ * Foo in a DataStream<Tuple7> / DataSet<Tuple7>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple8.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple8.java
index 2807509e8ac..ce5aa971a60 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple8.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple8.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 8 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple8, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple8", then don't use instances of
+ * Foo in a DataStream<Tuple8> / DataSet<Tuple8>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple9.java b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple9.java
index 70bbdf7eb7f..cd3a18ccb6d 100644
--- a/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple9.java
+++ b/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple9.java
@@ -32,10 +32,17 @@ import org.apache.flink.util.StringUtils;
* A tuple with 9 fields. Tuples are strongly typed; each field may be of a separate type.
* The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position
* through the {@link #getField(int)} method. The tuple field positions start at zero.
- *
- * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
- * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
*
+ *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work
+ * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
+ *
+ * Warning: If you subclass Tuple9, then be sure to either
+ * - not add any new fields, or
+ * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant
+ * type. (That is, if you have a "class Foo extends Tuple9", then don't use instances of
+ * Foo in a DataStream<Tuple9> / DataSet<Tuple9>, but declare it as
+ * DataStream<Foo> / DataSet<Foo>.)
+ *
* @see Tuple
*
* @param The type of field 0
diff --git a/flink-core/src/test/java/org/apache/flink/api/java/tuple/TupleGenerator.java b/flink-core/src/test/java/org/apache/flink/api/java/tuple/TupleGenerator.java
index ee3719402b3..200c760d750 100644
--- a/flink-core/src/test/java/org/apache/flink/api/java/tuple/TupleGenerator.java
+++ b/flink-core/src/test/java/org/apache/flink/api/java/tuple/TupleGenerator.java
@@ -166,7 +166,7 @@ class TupleGenerator {
// package and imports
w.println("package " + PACKAGE + ';');
w.println();
- w.println("import PublicInterface;");
+ w.println("import org.apache.flink.annotation.Public;");
w.println("import org.apache.flink.util.StringUtils;");
w.println();
@@ -175,17 +175,24 @@ class TupleGenerator {
w.println(" * A tuple with " + numFields + " fields. Tuples are strongly typed; each field may be of a separate type.");
w.println(" * The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position");
w.println(" * through the {@link #getField(int)} method. The tuple field positions start at zero.");
- w.println(" * ");
- w.println(" * Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work");
- w.println(" * with Tuples to reuse objects in order to reduce pressure on the garbage collector.");
w.println(" *");
+ w.println(" *
Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work");
+ w.println(" * with Tuples to reuse objects in order to reduce pressure on the garbage collector.
");
+ w.println(" *");
+ w.println(" * Warning: If you subclass " + className + ", then be sure to either
");
+ w.println(" * - not add any new fields, or
");
+ w.println(" * - make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant");
+ w.println(" * type. (That is, if you have a \"class Foo extends " + className + "\", then don't use instances of");
+ w.println(" * Foo in a DataStream<" + className + "> / DataSet<" + className + ">, but declare it as");
+ w.println(" * DataStream<Foo> / DataSet<Foo>.)
");
+ w.println(" *
");
w.println(" * @see Tuple");
w.println(" *");
for (int i = 0; i < numFields; i++) {
w.println(" * @param <" + GEN_TYPE_PREFIX + i + "> The type of field " + i);
}
w.println(" */");
- w.println("@PublicInterface");
+ w.println("@Public");
w.print("public class " + className + "<");
for (int i = 0; i < numFields; i++) {
if (i > 0) {
@@ -444,12 +451,12 @@ class TupleGenerator {
w.println("import java.util.ArrayList;");
w.println("import java.util.List;");
w.println();
- w.println("import PublicInterface;");
+ w.println("import org.apache.flink.annotation.Public;");
w.println("import " + PACKAGE + ".Tuple" + numFields + ";");
w.println();
// class declaration
- w.println("@PublicInterface");
+ w.println("@Public");
w.print("public class " + className);
printGenericsString(w, numFields);
w.println(" {");
--
GitLab