[ 
https://issues.apache.org/jira/browse/FLINK-17530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155233#comment-18155233
 ] 

Martijn Visser commented on FLINK-17530:
----------------------------------------

On JDK 17 this is no longer a warning. A MapFunction whose Serializable helper 
holds a java.net.http.HttpClient fails in bin/flink run with 
InaccessibleObjectException: Unable to make field static final 
java.lang.ref.Cleaner jdk.internal.net.http.HttpClientFacade.cleaner 
accessible, thrown from ClosureCleaner.clean, instead of the serializability 
error. Reproduced with the current master ClosureCleaner on JDK 17.0.20.

> Fix illegal reflective access by ClosureCleaner
> -----------------------------------------------
>
>                 Key: FLINK-17530
>                 URL: https://issues.apache.org/jira/browse/FLINK-17530
>             Project: Flink
>          Issue Type: Sub-task
>          Components: API / DataStream
>    Affects Versions: 1.11.0
>            Reporter: Robert Metzger
>            Priority: Major
>
> To reproduce:
> {code}
>       @Test
>       public void testJava11Warning() {
>               MapFunction<String, String> fun = new MapFunction<String, 
> String>() {
>                       String field = "asdf";
>                       @Override
>                       public String map(String value) throws Exception {
>                               return value + field;
>                       }
>               };
>               ClosureCleaner.clean(fun, 
> ExecutionConfig.ClosureCleanerLevel.RECURSIVE, false);
>       }
> {code}
> Causes:
> {code}
> WARNING: Illegal reflective access by 
> org.apache.flink.api.java.ClosureCleaner 
> (file:/Users/robert/Projects/flink/flink-core/target/classes/) to field 
> java.lang.String.value
>       at 
> org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:104)
>       at 
> org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:126)
>       at 
> org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:71)
>       at 
> org.apache.flink.api.java.ClosureCleanerTest.testJava11Warning(ClosureCleanerTest.java:58)
> {code}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to