diggsweden / dgc-java

Java implementation of the EU eHealth Digital Green Certificates.
MIT License
27 stars 25 forks source link

Lower java.version to 1.8 #49

Closed aegyed closed 3 years ago

aegyed commented 3 years ago

Here in Hungary, our central national healthcare backend still runs on Java 1.8 so we cannot integrate dgc-java compiled against Java 11

martin-lindstrom commented 3 years ago

I am sorry, but we can't do that. The library has dependencies to other artifacts that are built with Java 11 and it would be too much work to downgrade.

Java 8 is EOL and you should consider running your backend on a more modern version of Java.

aegyed commented 3 years ago

I have tried to do so, just replaced java.version in gdc-parent pom to 1.8, without any code changes in gdc-java, then compiled it, producing java 1.8 class files. This version could be used in our system, and I was able to create QR codes with it.

I also swept trough your dependencies and found only none that explicitly requires Java 11:

se.swedenconnect.security
  <artifactId>credentials-support</artifactId>

Also, some of them are multi version packages, containing classes for both java <1.8, 9, and 15 (like org.bouncycastle.bcprov-jdk15on), but all of these are still usable on Java 1.8 as well.

My guess is that credentials-support may (or should) be considered optional, as DefaultDGCSigner can still be used with the other constuctor. The single interface used here (se.swedenconnect.security.credential.PkiCredential) does not cause compile problems building gdc-java, as long as the build is actually done using JDK 11 but with target version 1.8.

I'm also aware of Java 8 EOL, and not happy I had to ask for this, but currently it's not an option in our system :(

martin-lindstrom commented 3 years ago

OK. You are right. I have made credentials-support optional on request from DK.

You know what. For each release I'll build a java 8 version along with the java 11 build. It should work as long as I use different artifact names. I'll keep you posted.

aegyed commented 3 years ago

Relieved to hear that, thank you.

One more thing I noticed is that MrzEncoder does not work well with Java 8, the regex for the final replaceAll replaces all characters to '<'. I have changed the regex to '[^<A-Z0-9]', this works fine with both 8 and 11.

martin-lindstrom commented 3 years ago

Would be great to receive a PR with those changes ...

21 maj 2021 kl. 14:56 skrev Árpád Egyed @.***>:

 Relieved to hear that, thank you.

One more thing I noticed is that MrzEncoder does not work well with Java 8, the regex for the final replaceAll replaces all characters to '<'. I have changed the regex to '[^<A-Z0-9]', this works fine with both 8 and 11. (I also needed to create my own MrzEncoder to support Hungarian accented characters, but that's another issue)

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

martin-lindstrom commented 3 years ago

@aegyed The libraries can now be built for and by Java 8. Use the j8-build profile.

mvn clean install -P\!default,j8-build