Logisim-Ita / Logisim

Logisim Italian Fork
https://logisim.altervista.org/
GNU General Public License v3.0
145 stars 39 forks source link

Handle OpenJDK 18 version number #31

Closed johnterickson closed 1 year ago

johnterickson commented 2 years ago

On Ubnutu 22.04 I have openJDK 18 installed and it has a version string that confuses the detection logic. It looks like all the comparisons were against the major version only, so I changed it to an int.

Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.NumberFormatException: For input string: "18-ea"
        at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
        at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
        at java.base/java.lang.Double.parseDouble(Double.java:651)
        at com.cburch.logisim.Main.getVersion(Main.java:56)
        at com.cburch.logisim.Main.<clinit>(Main.java:47)
john@jerick-x1-2:~/lutcomp/logisim$ java --version
openjdk 18-ea 2022-03-22
OpenJDK Runtime Environment (build 18-ea+36-Ubuntu-1)
OpenJDK 64-Bit Server VM (build 18-ea+36-Ubuntu-1, mixed mode, sharing)
AndreaAlbanese commented 1 year ago

Hi, sorry for the late response, but we're experiencing some organizational changes inside the Logisim-Ita team.

@zMasterAle and I have reviewed your pull request.

We notice that your regex respond the same result if we have for example openjdk 1.8.0_345 or openjdk 11.0.16. Or like in your case where the version is 18, but we receive back 8 and this could be misleading because it could seam Java 8 that have the version number like 1.8

Accordingly, we are trying to find the best way to implement this version check. We propose this regex expression ^(\d+\.?\d+).*, java escaped version ^(\\d+\\.?\\d+).* that allow to maintain our major and minor version checks and at the same time handle OpenJDK versions like yours.

We are glad if you will give us feedback to find the best way to resolve this issue.

Thanks.