Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-27549

Inconsistent bytecode version when enable jdk11 or higher version

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.14.4, 1.15.0
    • None
    • API / Scala
    • None

    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.

      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 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.
      We can see from scalac, the first is 2.12 the next is scala 2.13:

      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.

      <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>
      

      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?

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            taoran Ran Tao

            Dates

              Created:
              Updated:

              Slack

                Issue deployment