[
https://issues.apache.org/jira/browse/FLINK-17530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17099998#comment-17099998
]
Robert Metzger commented on FLINK-17530:
----------------------------------------
Why is this happening?
{{ClosureCleaner}} tries to access a private field in the {{java.base}}
package. According to its {{module-info.class}}, it does not {{opens}} any of
its packages.
With the module system in Java 9+, modules need to either be completely open
"open module ...", or specific packages need to be declared open. {{java.base}}
is not opening anything.
Solutions:
- Change closure cleaner to ignore Objects from "java.base"
Not a good solution, because these classes can contain references
- Force-open all "java.base/java.lang" packages by starting the JVM with
{{--add-opens java.base/java.lang=ALL-UNNAMED}}.
This solution requires us to modify the bash scripts, to detect a java 11
environment, and add the argument.
> 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
> Assignee: Robert Metzger
> Priority: Major
> Fix For: 1.11.0
>
>
> 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
(v8.3.4#803005)