Closed hgschmie closed 7 months ago
For the time being, I intend to keep this JDK8 compatible, so it has to be built with 8 as the target. But with that, I have no problems building it with JDK17. Not sure why you're having issues.
Makes sense. I tried mvn clean install
with JDK 8, 11, 17 and 21 and 11-21 all show the errors above.
When I replace the <source>1.8</source>
and <target>1.8</target>
configuration in the pom with <release>8</release>
, then the code does compile with 11, 17 and 21 (but no longer with Java 8, because the java 8 compiler does not have a --release
command line option.
With Java 11 and 21, I still see the errors described above. With Java 17 (!), I only see the Issue17 (so the problem with TestIssue20 and TypeFactoryTest do not show up with Java 17)
If you are interested, I can get you some github action CI scripts (basically the same that we run for Jdbi) to test for this.
Ok, I see the issue with JDK21. Seems like the toString
implementation has yet again changed to now use canonical type names instead of the regular names. This logic wasn't touched since Java 5, but now changes every release for whatever reason... At this point, I think it's pointless to try chasing toString
compatibility with Java, so I'll drop/rewrite those tests.
I don't get the following error with 21 though:
[ERROR] Issue20Test.testRecursiveTypes:60 array lengths differed, expected.length=5 actual.length=2; arrays first differed at element [0]; expected:<interface io.leangen.geantyref.Annotations$A1> but was:<interface io.leangen.geantyref.Annotations$A2>
Ah, ok, I get the error above with JDK11. I think this is sort of expected. JDKs before ~15 had quite a few bugs in annotation parsing (you'll find strange mitigations for this all over the codebase). I'm OK with the project requiring JDK17+ to build, as long as JDK8 compatibility is kept for a little longer, but I'm also OK with dropping that soon.
Ok, moving the inner interfaces to the upper level was enough of a mitigation to make JDK11 pass as well. So I'll keep it that way.
If you are interested, I can get you some github action CI scripts (basically the same that we run for Jdbi) to test for this.
Yes, please, this would indeed be helpful 🙏
Fixed this in https://github.com/leangen/geantyref/commit/70fc31fc54b093468a225a0a78d7893c6831284c
JDK11 is the minimum required to build.
With JDK 11:
With JDK 8, the current code compiles but shows errors: