Hi, Martijn. Thanks for responding, i have read these issues, and the
issues u mentioned are about the compatibility of current released
version(which use jdk8), so we are stuck with 2.12.7.   But my concern is
more about optional jdk11 build, when we use jdk11, we must enable
jdk11-target optional profile.
It will has no impact for current released version(and future newer jdk8
released version) and will not breaks compatibility. just set matched scala
version property for optional jdk11.  then we can use -target:11 for
generating scala jvm11 bytecode and solve some build errors with jdk11 &
jdk17 by the way, for example: FLINK-25000 [2]

And i have noticed that the scala community will backport the target jvm
support from 2.13 to newer 2.12.16[1] It will make -target support JVM
8-19. It means if we want to support flink pure jdk11 version, may be 2.12
is both ok.

Can we start a discuss and let other devs involved to vote for supporting
pure jdk11 version ?

[1] https://github.com/scala/bug/issues/12588
[2]

Martijn Visser <martijnvis...@apache.org> 于2022年5月9日周一 15:55写道:

> Hi Ran,
>
> Thanks for opening the discussion. There's a Flink ticket already for
> adding Scala 2.13 support [1] and also for upgrading to the latest Scala
> 2.12 version [2]. The problem for upgrading to a later version of Scala is
> outlined in [3]. We couldn't upgrade to later versions of Scala because of
> a breaking change that Scala introduced after Scala 2.12.8. I'm assuming
> that this would also block the introduction of Scala 2.13, but I'm no Scala
> expert so I'm looking forward to input from others.
>
> One thing suggested was to do an inventory among the Dev and User mailing
> list if they would be OK to break the API over sticking with Scala 2.12.8.
> I don't think that was done before.
>
> Best regards,
>
> Martijn Visser
> https://twitter.com/MartijnVisser82
> https://github.com/MartijnVisser
>
> [1] https://issues.apache.org/jira/browse/FLINK-13414
> [2 https://issues.apache.org/jira/browse/FLINK-20969
> [3] https://issues.apache.org/jira/browse/FLINK-12461
>
> On Mon, 9 May 2022 at 09:26, Ran Tao <chucheng...@gmail.com> wrote:
>
> > Hi, guys.
> >
> > I have found out that current flink project build with jdk11 wasn't
> > implemented completed or pure jdk11 version. (higher version has same
> > problem)
> >
> > 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 so the source 11 and target 11. ->
> > build java also ok. But the generated bytecode version of scala class is
> > already 52(jdk8). We can test with any of a scala classes under jdk11
> build
> > target. e.g.
> >
> > javap -verbose AggregateDataSet.class | grep major
> > major version: 52
> >
> > I have test many times and make conclusion that flink jdk11 now is not a
> > completed or 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 unknown errors
> > 3. Runtime jdk11 environment can not optimize these lower bytecode.
> >
> > I have dipped into this problem including reading carefully from scala
> docs
> > and asking from scala community[1][2] 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 generating scala target 11 bytecode and higher and also jdk8.
> >
> >
> > So I launch this discussion to see whether we can add scala-2.13 in flink
> > jdk11 profile to support the completed or pure jdk11(or higher) version.
> >
> > And if we do not support and decide to maintain the current situation, I
> > think we should let users or developers know this inconsistent problem,
> for
> > example, update or make some comments in flink pom or docs.
> >
> > More details:
> >
> > https://issues.apache.org/jira/browse/FLINK-27549
> >
> > [1] https://github.com/scala/bug/issues/12588
> >
> > [2]
> https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html
> >
> >
> > --
> > Best,
> > Ran Tao
> >
>


-- 
Best,
Ran Tao

Reply via email to