dmvk 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_r307166110
 
 

 ##########
 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:
   Changed.
   
   Anyway this seems to differ a lot throughout the code base. The way I'm 
trying to think about this is that static code should always appear before 
non-static. It is usually confusing if static and instance classes are mixed 
together.
   
   - static properties
   - static methods
   - static classes
   - instance properties
   - instance methods
   - instance classes

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to