Skip to content

fix(scala): target Java 8 bytecode for fory-scala - #3941

Open
KarasevRob wants to merge 1 commit into
apache:mainfrom
KarasevRob:agent/fix-scala-java-target
Open

fix(scala): target Java 8 bytecode for fory-scala#3941
KarasevRob wants to merge 1 commit into
apache:mainfrom
KarasevRob:agent/fix-scala-java-target

Conversation

@KarasevRob

Copy link
Copy Markdown

Why?

fory-scala Java sources are compiled with JDK 25 during release, producing Java 25 bytecode

What does this PR do?

Set the Java target to Java 8:

Compile / javacOptions ++= Seq("--release", "8")

Analogue to fory-json-scala

Related issues

Does this PR introduce any user-facing change?

Fixes fory-scala compatibility with supported older JDKs.

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

Not applicable.

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

The .scala source files should still be Java 8 compatible - because the Scala compiler still targets Java 8 (unless you bump to Scala 3.8+ for the compiler)

The .java source files in fory-scala need this setting in order not to target the java version associated with the javac compiler used at build time.

@pjfanning

Copy link
Copy Markdown
Member

Oddly foryJsonScala has the release setting but not foryScala.

Existing:

lazy val foryJsonScala = Project(id = "fory-json-scala", base = file("fory-json-scala"))
  .settings(commonSettings)
  .settings(
    name := "fory-json-scala",
    Compile / javacOptions ++= Seq("--release", "8"),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Scala] fory-scala 1.3.0-1.6.1 contains Java 25 bytecode and fails on JDK 21

2 participants