liuml07 commented on code in PR #26776:
URL: https://github.com/apache/flink/pull/26776#discussion_r3237290632


##########
flink-core/src/test/java/org/apache/flink/api/java/ClosureCleanerTest.java:
##########
@@ -133,6 +135,30 @@ void testComplexTopLevelClassClean() throws Exception {
         assertThat(result).isEqualTo(5);
     }
 
+    @Test
+    public void testCleanNonSerializableNestedMap() throws Exception {
+        MapFunction<Integer, Integer> complexMap =
+                new ComplexMap(
+                        new MapFunction<>() {
+                            private final Object obj = new Object(); // 
non-serializable
+
+                            @Override
+                            public Integer map(Integer value) {
+                                return value + obj.hashCode();
+                            }
+                        });
+        try {
+            ClosureCleaner.clean(complexMap, 
ExecutionConfig.ClosureCleanerLevel.RECURSIVE, true);
+            fail("Should have failed with InvalidProgramException exception");
+        } catch (InvalidProgramException e) {
+            final String msg = e.getMessage();
+            // Verify that the error message contains the reference chain
+            final String regex =
+                    ".*ComplexMap -> .*LocalMap -> .*ClosureCleanerTest.* -> 
.*Object.*";

Review Comment:
   Thanks @davidradl 
   
   1. I have considered the 3 options. I feel at "class-level" not "field 
level", this is still meaningful improvement
     - [A -> B -> C] — direction explicit, fits on one line, common idiom (call 
traces, type arrows).
     - [A, B, C] — looks like a set; reader has to guess which end is the root.
     - Indented multi-line — readable, but unusual inside an exception message.
   2. Yes that might be a good idea, but I'll take that as a follow-up for 
field-level information.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to