tuxji commented on code in PR #1090:
URL: https://github.com/apache/daffodil/pull/1090#discussion_r1345225847
##########
build.sbt:
##########
@@ -245,19 +251,19 @@ lazy val commonSettings = Seq(
def buildScalacOptions(scalaVersion: String) = {
val commonOptions = Seq(
- "-target:jvm-1.8",
+ // s"-target:$minSupportedJavaVersion", // scala 2.12 can only target Java
8.
"-feature",
"-deprecation",
"-language:experimental.macros",
"-unchecked",
- "-Xfatal-warnings",
"-Xxml:-coalescing",
"-Xfuture",
"-Ywarn-infer-any",
"-Ywarn-inaccessible",
// "-Ywarn-nullary-unit", // we cannot use this. It interferes with the
Uniform Access Principle.
// See
https://stackoverflow.com/questions/7600910/difference-between-function-with-parentheses-and-without.
"-Ywarn-unused-import",
+ "-Xfatal-warnings",
Review Comment:
Up to you (I am fine with ignoring my comment), but "-Xfatal-warnings" has
been removed at one line number and added back at a different line number (an
unnecessary change).
##########
build.sbt:
##########
@@ -268,29 +274,29 @@ def buildScalacOptions(scalaVersion: String) = {
case _ => Seq.empty
}
- val javaVersionSpecificOptions =
- if (scala.util.Properties.isJavaAtLeast("9"))
- Seq("-release", "8") // ensure Java backwards compatibility
(DAFFODIL-2579)
- else
- Seq.empty
+ commonOptions ++ scalaVersionSpecificOptions
+}
+
+val javaVersionSpecificOptions = {
+ val releaseOption = // as of Java 11, they no longer accept "-release". Must
use "--release".
+ if (scala.util.Properties.isJavaAtLeast("11")) "--release" else "-release"
- commonOptions ++ scalaVersionSpecificOptions ++ javaVersionSpecificOptions
+ // Java 21 deprecates Java 8 and warns about it.
+ // So if you are using Java 21, Java code compilation will specify a newer
Java version
+ // to avoid warnings.
+ if (scala.util.Properties.isJavaAtLeast("11")) Seq(releaseOption,
minSupportedJavaVersion)
+ else if (scala.util.Properties.isJavaAtLeast("9")) Seq(releaseOption, "8")
+ else Nil // for Java 8 compilation
}
// Workaround issue that some options are valid for javac, not javadoc.
// These javacOptions are for code compilation only. (Issue sbt/sbt#355)
def buildJavacOptions() = {
val commonOptions = Seq(
- "-Werror",
"-Xlint:deprecation",
+ "-Werror",
Review Comment:
Ditto here too, unnecessary change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]