michael-hoke commented on code in PR #1057:
URL: https://github.com/apache/daffodil/pull/1057#discussion_r1340443578
##########
build.sbt:
##########
@@ -211,6 +212,43 @@ lazy val testStdLayout =
Project("daffodil-test-stdLayout", file("test-stdLayout
.dependsOn(tdmlProc % "test")
.settings(commonSettings, nopublish)
+/* Workaround: certain reflection (used by JAXB) isn't allowed by default in
JDK 17:
+ *
https://docs.oracle.com/en/java/javase/17/migrate/migrating-jdk-8-later-jdk-releases.html#GUID-7BB28E4D-99B3-4078-BDC4-FC24180CE82B
+ *
+ * While we can handle this JVM quirk at build time, at runtime we won't know
+ * a user's JVM version. We'll provide documentation and an extension setting
+ * to add these flags to the extension-launched debugger backend.
+ */
+lazy val extraJvmOptions: Seq[String] =
+ if (scala.util.Properties.isJavaAtLeast("17"))
+ Seq(
+ "--add-opens",
+ "java.base/java.lang=ALL-UNNAMED",
+ )
+ else Seq()
+
+lazy val xjcSettings =
+ Seq(
+ libraryDependencies ++= Seq(
+ "com.sun.xml.bind" % "jaxb-impl" % "2.2.11",
+ "javax.activation" % "activation" % "1.1.1",
+ "org.glassfish.jaxb" % "jaxb-xjc" % "2.2.11",
+ ),
+ xjcCommandLine += "-nv",
+ xjcCommandLine += "-p",
+ xjcCommandLine += "org.apache.daffodil.tdml",
+ xjcLibs := Seq(
+ "org.glassfish.jaxb" % "jaxb-xjc" % "2.2.11",
Review Comment:
If two items in all imported schemas (elements, attributes, etc.) share a
name, JAXB will attempt to create a binding for them at the same Java file
location, which, obviously, won't work, so there needs to be a way to tell it
how to rename one of them. With the SbtXjcPlugin, that is the bindings.xjb
file. With the scalaxb plugin, I could not find a way to do this outside of
refactoring the schemas so that everything has a unique name or by submitting a
patch to the plugin to support a bindings file... Although, the tdml-core
refactor also resolves this as long as we only want JAXB bindings for that
subset of the TDML schema.
If you are going to eventually integrate the JAXB bindings into the
TDMLRunner, I imagine that would require generating bindings for the base DFDL
schemas, which do have clashing names in a few places. I'm not suggesting that
we make any changes at this point - just want to point it out so that this
isn't a surprise if/when you get to this point.
--
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]