You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/07/23 15:00:23 UTC

[GitHub] [flink] mxm commented on a change in pull request #9201: [FLINK-13367] Add support for writeReplace in nested ClosureCleaner.

mxm commented on a change in pull request #9201: [FLINK-13367] Add support for writeReplace in nested ClosureCleaner.
URL: https://github.com/apache/flink/pull/9201#discussion_r306368121
 
 

 ##########
 File path: flink-java/src/test/java/org/apache/flink/api/java/functions/ClosureCleanerTest.java
 ##########
 @@ -421,3 +428,59 @@ public Integer map(Integer value) throws Exception {
 	}
 }
 
+class WithWriteReplace implements Serializable {
+
+	static class Payload {
+
+		private final String raw;
+
+		Payload(String raw) {
+			this.raw = raw;
+		}
+
+		String getRaw() {
+			return raw;
+		}
+	}
+
+	private static class SerializablePayload implements Serializable {
+
+		private final Payload payload;
+
+		SerializablePayload(Payload payload) {
+			this.payload = payload;
+		}
+
+		private Object writeReplace() {
+			return new SerializedPayload(payload.getRaw());
+		}
+
+		Payload get() {
+			return payload;
+		}
+	}
+
+	private static class SerializedPayload implements Serializable {
+
+		private final String raw;
+
+		private SerializedPayload(String raw) {
+			this.raw = raw;
+		}
+
+		private Object readResolve() throws IOException, ClassNotFoundException {
+			return new Payload(raw);
+		}
+	}
+
+	private final SerializablePayload serializablePayload;
+
+	WithWriteReplace(Payload payload) {
 
 Review comment:
   I'm not used to this style of having classes first, then fields and the constructor. Maybe switch these around?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services