Avoid inlining calls to sun.reflect.CallerSensitive annotated methods
Closed this issue · 5 comments
These are known to inspect the stack frame to lookup the calling class or method name.
Will this issue be addressed in Scala 2.11 ? I am asking as sun.reflect.CallerSensitive was removed from JDK9, so this patch is needed to run 2.11 compiled code on JDK9.
sun.reflect.CallerSensitive was removed from JDK9
Do you have a reference for this? I'd like to read up.
We're not planning to fix this in 2.11.x (at this point), but I don't understand yet how it relates to the ability of running 2.11-compiled code on JDK 9, so I might be missing something important.
My point was that sun.reflect.CallerSensitive has been removed in JDK9, so inlining of methods using sun.reflect.CallerSensitive could potentially cause problems when the JDK9 runtime cannot find the class. I noticed CallerSensitive in class files produced by scalac (it happens when an object extends Thread), and decided to investigate.
It turns out that missing runtime annotations are ignored by the class file parser (since java 1.5), so as long as sun.reflect.CallerSensitive is only used as an annotation, then there shouldn't be a problem. So I think everything is fine today, but inlining methods from the JDK is generally fishy as the JDK is tightly coupled to the JVM (minor version skew between the JDK and the JVM can break everything).
(hi Carsten!)
thanks for the clarification! this is something to point out in the release notes. when inlining from a jar, users need to make sure to use the versions at runtime.
we are working on providing much more fine-grained compiler options that will allow people to specify where to inline from, see #148. thanks for pointing out that we also need to take the JDK version into this mix.