I have some AOT compiled code which includes babashka.process. I've compiled (with Java 11, I think), but I have users who have Java 8. The AOT compiled code fails with exceptions related to using features that don't exist in Java 8. In my case, it's easy enough to ask my users to upgrade Java, so I have a workaround, but I thought I'd report the problem anyway.
babashka.process attempts to be compatible with different versions of the JDK with the if-before-jdk8macro. But the macro isn't compatible with AOT compilation. When AOT compiled with Java 9+, the macro expands to the post-8 branch during compilation. This means that the post-8 branch will always execute, even if run with Java 8.
It's tempting to suggest adding a syntax-quote outside the (if (identical?..., so that the check happens at runtime, not compile time. But I don't think that's the only change that would be necessary. Several def and defn forms are wrapped in if-before-jdk8. To make the check happen at runtime, if-before-jdk8 would have to be moved inside those forms.
Edit: Understood if Java 8 support isn't something you want to spend time on. :)
I have some AOT compiled code which includes
babashka.process
. I've compiled (with Java 11, I think), but I have users who have Java 8. The AOT compiled code fails with exceptions related to using features that don't exist in Java 8. In my case, it's easy enough to ask my users to upgrade Java, so I have a workaround, but I thought I'd report the problem anyway.babashka.process
attempts to be compatible with different versions of the JDK with theif-before-jdk8
macro. But the macro isn't compatible with AOT compilation. When AOT compiled with Java 9+, the macro expands to thepost-8
branch during compilation. This means that thepost-8
branch will always execute, even if run with Java 8.It's tempting to suggest adding a syntax-quote outside the
(if (identical?...
, so that the check happens at runtime, not compile time. But I don't think that's the only change that would be necessary. Severaldef
anddefn
forms are wrapped inif-before-jdk8
. To make the check happen at runtime,if-before-jdk8
would have to be moved inside those forms.Edit: Understood if Java 8 support isn't something you want to spend time on. :)