> MethodHandles are currently not supported in native-image. This has been documented in https://github.com/oracle/graal/blob/master/substratevm/LIMITATIONS.md#invokedynamic-bytecode-and-method-handles. We are however looking to address this issue in the future From https://github.com/oracle/graal/issues/2214
@borkdude it can't see through the isJava8() predicate and determine which MH is chosen in Reflector.java
yeah
I'm no longer convinced that code in Reflector is accurate enough. There are some warnings it fails to catch.
(the canAccess() logic)
do we really care about the module system from a clojure perspective?
it's not about caring about module system
it's about the module system changed visibility rules
and we have to be sensitive to them -- otherwise IllegalAccess
why is catching it in Reflector.java better than IllegalAccess?
public class in the module system is only public if its package is exported by the module
whereas on java8 public class is... public
the Reflector shouldn't select/link methods it cannot call
Java / JVM itself will give an error about this. Why not let it crash there?
because there often is a public method you can call
scenario: public class Impl in a non-exported package, with a method foo() that it implements from public exported interface IFoo
if the Reflector selects Impl.foo() it is wrong, it needs to walk up the class hierarchy to find the IFoo.foo() method
ah right.
get it now
groovy does this:
which is more correct IMHO, but they also dynamically load the class containing that method
For sci I've made a slight variation of clojure.lang.Reflector packaged as a library (for internal use). I've made two releases of this library: one for jdk8 and one for jdk11 so they can both work with GraalVM. That could be one approach of dealing with JVM-specific things.
I'm not sure how the rest of the Java world deals with these problems
thanks for sharing the Groovy example
there's a long history of issues they wrestled with https://issues.apache.org/jira/browse/GROOVY-9103 https://issues.apache.org/jira/browse/GROOVY-9081 https://issues.apache.org/jira/browse/GROOVY-8339
@ghadi How does Groovy deal with Java8/Java11 compatibility?
¯\(ツ)/¯
if i were to make something up, I'd guess that they do Java8 baseline and don't depend on anything above that
that class above ^ is in a directory called "vmplugin/v9" which appears to be conditionally loaded
( btw thanks for the latest Cognicast, enjoyed listening to it today )
cool thanks! lvh is a hoot