FYI I'm hitting: Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of http://java.io.FilePermission are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked. Detailed message: Trace: Object was reached by reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant java.util.concurrent.ConcurrentHashMap$Node@12f4cf5d reached by indexing into array constant java.util.concurrent.ConcurrentHashMap$Node@2ac46e53 reached by reading field java.util.concurrent.ConcurrentHashMap.table of constant java.util.concurrent.ConcurrentHashMap@12f4cf5d reached by reading field http://java.io.FilePermissionCollection.perms of constant http://java.io.FilePermissionCollection@afc768e reached by reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant java.util.concurrent.ConcurrentHashMap$Node@5e7666a1 reached by indexing into array constant java.util.concurrent.ConcurrentHashMap$Node@4b4549be reached by reading field java.util.concurrent.ConcurrentHashMap.table of constant java.util.concurrent.ConcurrentHashMap@5e7666a1 reached by reading field java.security.Permissions.permsMap of constant java.security.Permissions@773c8886 reached by reading field java.security.ProtectionDomain.permissions of constant java.security.ProtectionDomain@2f112965 reached by indexing into array constant java.security.ProtectionDomain@7374ce00 reached by reading field java.security.AccessControlContext.context of constant java.security.AccessControlContext@2f112965 reached by reading field http://java.net.URLClassLoader.acc of constant clojure.lang.DynamicClassLoader@1850c234 reached by reading field java.lang.Class.classLoader of constant java.lang.Class@18407f5c reached by Hub
which I can only find examples of via search to this channel
This is with 20.0.0 + jdk11, which unfortunately I need
(jdk11, that is)
https://github.com/latacora/wernicke master if anyone wants to try for themselves
looks like that's a fairly common jdk11 problem: https://github.com/BrunoBonacci/graalvm-clojure/search?q=java.io.FilePermission&unscoped_q=java.io.FilePermission
I'm working on something I want to compile to a native binary using GraalVM. I'm making somewhat heavy use of Java interop. To make the resulting binary work, I have to pepper my codebase with type hints. I can compile the binary (using clj.native-image) just fine, but when I neglect to add a type hint somewhere, the binary throws a type-related exception when I run it.
The problem is that the feedback loop is pretty long: to detect any missing type hints, I first need to compile the native image (which can take quite long) and then run it.
Is there any way to shorten the feedback loop? Is there an option I can pass to the native image compiler to make it report the type errors, for example? Or can I leverage
*warn-on-reflection* is what you want to enable everywhere you do Java interop
Thanks! I do set it in my entry point namespace, but I guess I should set it in every namespace where I do Java interop. Will give it a try.
yes, every namespace1👀