You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Ran Tao (Jira)" <ji...@apache.org> on 2022/05/09 05:27:00 UTC
[jira] [Created] (FLINK-27549) Inconsistent bytecode version when enable jdk11 or higher version
Ran Tao created FLINK-27549:
-------------------------------
Summary: Inconsistent bytecode version when enable jdk11 or higher version
Key: FLINK-27549
URL: https://issues.apache.org/jira/browse/FLINK-27549
Project: Flink
Issue Type: Bug
Components: API / Scala
Affects Versions: 1.14.4, 1.15.0
Reporter: Ran Tao
Current flink project build with jdk1.8 is ok.
when enable jdk11, it has some scenarios.
1. Using jdk11 but source 1.8 target 1.8 it's ok.
2. Using jdk11 and with jdk11-target source 11 and target 11. build java ok. But the generated bytecode version of scala class is already 52(jdk8). We can test with any of a scala class under jdk11 build result. e.g.
{code:java}
javap -verbose AggregateDataSet.class | grep major
major version: 52
{code}
So, currently flink jdk11 is not a completed and pure jdk11 version because of inconsistent bytecode version with java & scala. And it may cause some problem, for example:
1.inconsistent bytecode version between java & scala
2.Using reflection about class may generate some unkown errors
3.Runtime jdk11 environment can not optimize these lower bytecode.
I have dipped into this problem and found out we must upgrade scala to 2.13. the 2.13 can support generate scala target 11 bytecode.( By the way, even scala 2.12 support generare 11 bytecode, current flink build also fail. Because the config about scala-maven-plugin is error, the correct format is target:[8],11,13,,15 not target:jvm-11)
{code:java}
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<args>
<arg>-nobootcp</arg>
<arg>-target:jvm-${target.java.version}</arg>
</args>
<jvmArgs>
<arg>-Xss2m</arg>
</jvmArgs>
</configuration>
</plugin>
{code}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)