[
https://issues.apache.org/jira/browse/DAFFODIL-2579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17450527#comment-17450527
]
Steve Lawrence commented on DAFFODIL-2579:
------------------------------------------
Yep, that's basically the issue. I found this stack overflow post that
describes the same issue with building/running Scala on different versions of
Java:
https://stackoverflow.com/questions/50876388/scala-script-doesnt-run-on-ubuntu/51223234#51223234
Ubuntu had the same issue where they compiled Scala with Java 11, and so it
wouldn't run on Java 8 because Java broke binary compatibility.
Ubuntu fixed this by patching the source to add additional type casts so things
would be binary compatible.
Scala fixed this by just always compiling with Java 8.
Our Daffodil releases are always built with Java 8, so our releases will never
have this problem. But developers or users building from source could have this
problem if they use different versions to build vs run Daffodil, which is what
Mike ran in to.
If we want to ensure there are no issues regardless of build/execution
environment, we would have to do what Ubunutu did and add some type casts in
the right places. That's probably not super trivial, but with some careful
grepping should be able to find all the instances where a cast is needed.
Or we just say this is a known issue and it's important that you don't mix and
match Java versions if you're building Daffodil from source.
> java compile compatibility issue with Java 16/17
> ------------------------------------------------
>
> Key: DAFFODIL-2579
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2579
> Project: Daffodil
> Issue Type: Improvement
> Components: General
> Affects Versions: 3.2.0
> Reporter: Mike Beckerle
> Assignee: Steve Lawrence
> Priority: Major
> Fix For: 3.2.0
>
>
> When testing the OpenDFDL hexWords example, I got this error message:
> {code}
> [warn]
> /home/mbeckerle/Documents/dataiti/git/dfdl-schemas/dfdl-examples/hexWords/src/main/java/hexWords/MessageParser.java:
>
> /home/mbeckerle/.ivy2/local/org.apache.daffodil/daffodil-japi_2.12/3.2.0-SNAPSHOT/jars/daffodil-japi_2.12.jar(/org/apache/daffodil/japi/ValidationMode.class):
> major version 61 is newer than 60, the highest major version supported by
> this compiler.
> {code}
> This appears to be due to the fact that my local snapshot of Daffodil had
> been compiled using Java 17, but my java-based hexWords application is using
> Java 16.
> Recompiling Daffodil with Java 16 fixes this.
> This does suggest that we must compile the Daffodil 3.2.0 distribution with
> Java 8, or we risk the daffodil libraries being incompatible backward for a
> user that is still using Java 8.
> Perhaps we need compilation options on Daffodil so that no matter what
> JVM/java version you are using, the jar files are backward compatible to Java
> 8?
--
This message was sent by Atlassian Jira
(v8.20.1#820001)