<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br><div><blockquote type="cite"><div>On May 14, 2023, at 6:07 PM, Ron Pressler <ron.pressler@oracle.com> wrote:</div><br class="Apple-interchange-newline"><div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">You can continue using JNI, but the application on newer releases will need to allow it. But the way to target multiple releases in a general and elegant way is with multi-release JARs.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"></div></blockquote></div><br><div>Multi-release JARs may be better than conditionals (if you are not supporting JDK 8, but I do), but that is not the issue.</div><div><br></div><div>The issue is that release-specific code may need to use deep reflection to fix bugs or compensate for limitations in a specific set of JDK releases.</div><div><br></div><div>As long as JNI reflection is not limited, I can make it work by telling clients of my library to enable JNI on the command line.</div><div>(But without build tool support, how will they know?)</div><div><br></div><div>But if JNI disappears in favor of direct access to C [is that not a long term goal?], then I will need some other way to perform “deep” reflection on the JDK. Unlike other uses of reflection that have been discussed, these uses could be statically declared. For example, I could declare that for some specified set of JDK releases, I need access to a particular field of a particular class, which might be used to prevent certain optimizations in an AOT build.</div><div><br></div><div>I guess you could call this a patch facility.</div><div><br></div></body></html>