[
https://issues.apache.org/jira/browse/FLINK-27549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ran Tao updated FLINK-27549:
----------------------------
Description:
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}
I have test many times and make conclusion that flink jdk11 now is not a
completed and pure jdk11 version because of inconsistent bytecode version with
java & scala. And it may cause some problems, 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(2.11 & 2.12 only support generate bytecode version <=1.8). the 2.13 can
support generate scala target 11 bytecode and higher and jdk8.( By the way,
even if scala-2.12 support generare 11 bytecode, current flink build also fail.
Because the config about scala-maven-plugin is error, the correct format about
jdk11 is target:11 not target:jvm-11, the latter format only for <=1.8 with
scala-2.11 and 2.12)
{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}
I wonder current the community whether to support the completed jdk11 version?
and if not, at least we need to comment in pom or flink docs to let users know
about this problem?
was:
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}
I have test many times and make conclusion that flink jdk11 now is not a
completed and pure jdk11 version because of inconsistent bytecode version with
java & scala. And it may cause some problems, 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(2.11 & 2.12 only support generate bytecode version <=1.8). the 2.13 can
support generate scala target 11 bytecode.( By the way, even if scala-2.12
support generare 11 bytecode, current flink build also fail. Because the config
about scala-maven-plugin is error, the correct format about jdk11 is target:11
not target:jvm-11, the latter format only for <=1.8 with scala-2.11 and 2.12)
{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}
I wonder current the community whether to support the completed jdk11 version?
and if not, at least we need to comment in pom or flink docs to let users know
about this problem?
> 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.15.0, 1.14.4
> Reporter: Ran Tao
> Priority: Major
>
> 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}
> I have test many times and make conclusion that flink jdk11 now is not a
> completed and pure jdk11 version because of inconsistent bytecode version
> with java & scala. And it may cause some problems, 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(2.11 & 2.12 only support generate bytecode version <=1.8). the 2.13 can
> support generate scala target 11 bytecode and higher and jdk8.( By the way,
> even if scala-2.12 support generare 11 bytecode, current flink build also
> fail. Because the config about scala-maven-plugin is error, the correct
> format about jdk11 is target:11 not target:jvm-11, the latter format only for
> <=1.8 with scala-2.11 and 2.12)
> {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}
> I wonder current the community whether to support the completed jdk11
> version? and if not, at least we need to comment in pom or flink docs to let
> users know about this problem?
--
This message was sent by Atlassian Jira
(v8.20.7#820007)