bjornvester / xjc-gradle-plugin

A Gradle plugin for running the XJC binding compiler to generate JAXB Java source code from XSD schemas
MIT License
59 stars 10 forks source link

Issues when changing from Java17 to Java21 #38

Open danielpeintner opened 6 months ago

danielpeintner commented 6 months ago

I use the plugin for creating JAXB classes for an Austrian standard (ÖNORM) which worked fine so far.

After upgrading the Java runtime from Java17 to Java21 I see a new issue popping up.

* What went wrong:
Execution failed for task ':jre'.
> Cannot cast object '[/at/oenorm/schema/a2063/_2009_06_01/AekKenndatenType.class]' with class 'java.util.ArrayList' to class 'java.lang.Void' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.lang.Void(String)

Attached the XSD set. XSDs.zip

It is also interesting to see that it works fine with gradle run and fails for gradle jpackage

As said, the only difference is the Java runtime used.

A simple test project can be found here: https://github.com/danielpeintner/Java11Test/tree/non-modular

Note: Using the Java21 and downgrading to 17 in my Gradle project solves the problem also!? Any ideas what is happening?

compileJava {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}