rjdverse / rjdemetra

R interface to JDemetra+ v 2.x
https://rjdverse.github.io/rjdemetra
52 stars 16 forks source link

Bugfix in Java version check #101

Closed amritrau closed 2 years ago

amritrau commented 2 years ago

Thanks for the great work on this package!

Currently, Java 15.x.x versions are rejected (d172c8a, introduced in #93).

> jv <- "15.0.1"
> jv <= 15
[1] FALSE

With this fix, Java 15 versions are accepted, as well as any legacy Java versions labeled 1.9.x (= Java 9) and 1.10.x (= Java 10).

> jv <- "15.0.1"
> jv >= "1.8.0" && substr(jv, 1L, 3L) <= "15."
[1] TRUE

This is tested on R 4.1.2 for MacOS Monterey with an M1 chip (64-bit arch) and Java version 15.0.6 as reported by

rJava::.jcall("java/lang/System", "S", "getProperty", "java.version")

Note that running the minimal example from the README (ipi_c_eu) works with Java 15.0.6, but produces an illegal reflective access warning:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by RJavaTools to method java.util.Collections$UnmodifiableCollection.isEmpty()
WARNING: Please consider reporting this to the maintainers of RJavaTools
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

I don't have all the context, but I suspect that this is known behavior – I'm guessing that the Java version restriction is because of Java 16's --illegal-access=deny default behavior. This is obviously an upstream issue in JDemetra+; judging by this comment, I further suspect that this warning will be resolved in the next JDemetra+ release.

AQLT commented 2 years ago

Thank you for your contribution! I will test is as soon as possible (to be sure it still returns an error with java < 8). The warning will be removed in the next release of RJDemetra (and the package will also be compatible with Java >=16).