You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Jython 2.7.2 on JRE25: JEP 498 sun.misc.Unsafe deprecation warning from bundled Guava #449
Running Jython 2.7.2 embedded under JDK 25 produces this at startup:
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by org.python.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper (file:.../jython-standalone.jar)
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
Root cause: the shaded Guava copy under org.python.google.common.* still uses Unsafe.objectFieldOffset() in AbstractFuture$UnsafeAtomicHelper's static initializer (confirmed via javap -c against the bundled jar — 5 calls, one per field: waiters, listeners, value, thread, next). JDK 24+ warns on this per JEP 498; the memory-access methods are slated for removal per JEP 471.
I looked as to whether upgrading to 2.7.4 resolves this. Per NEWS, 2.7.2 bundles guava-22.0-android, and 2.7.4 (GH-269) bumps to guava-32.0.1. However, Guava's own issue tracker (google/guava#6806, PR #7555/#7759) shows the fix — trying VarHandle before Unsafe in AbstractFuture — didn't land until after 33.4.0-jre, i.e. Guava 33.4.1+. So poss even the current Jython 2.7.4 with Guava 32.0.1 still triggers this warning. I'm note sure that upgrading Jython alone won't fix it as things stand?
Questions:
Is there an open issue/PR tracking a further Guava bump to ≥33.4.1 in the shaded jar? I didn't find one in the GH-3xx range.
I assume Jython 2.7.5 is targeting support for java 25? Is specifically silencing this warning on the roadmap at all, or is it considered out of scope for the 2.7.5 release?
Is there a supported way to suppress this at the embedding-application level (e.g. via a system property Jython sets internally) short of the host JVM launcher passing --sun-misc-unsafe-memory-access=allow?
Environment: Jython 2.7.2 standalone jar, embedded in a desktop Java app, running under JDK 25.
I assume Jython 2.7.5 is targeting support for java 25? Is specifically silencing this warning on the roadmap at all, or is it considered out of scope for the 2.7.5 release?
We'll tolerate Java 25 to the extent possible. #435 ;-) Not suppress, but avoid generating it where we can.
Is there a supported way to suppress this at the embedding-application level (e.g. via a system property Jython sets internally) short of the host JVM launcher passing --sun-misc-unsafe-memory-access=allow?
Probably not in an application that embeds Jython (rather than runs Jython with the launcher or java command). It's a thing you ask the JVM to tolerate. I don't know if that can be changed once running. The launcher has sprouted options necessary to tolerate some unsafe access in #435.
Have you noticed the jython-slim JAR which gives you more scope for choosing your own dependencies without shading?
Thanks for replying... So I'm not sure where that leaves 2.7.4/5? Are you saying that this unsafe warning will somehow be eliminated in 2.7.5 (by somebody, somehow)? Or does someone have to do something? Thanks
If your code or a dependency does something that raises such warnings, it is outside our scope to suppress it, and I think you ought to know anyway. However, we have made some code changes (in 2.7.4 I think) and are updating dependencies, including the Guava one, to avoid generating it where we can. So it's as fixed as it can be.
I think you still get it if you operate on a file handle in Windows.
Activity
jeff5 commentedon Jul 26, 2026
Already on it: #438, #448
We'll tolerate Java 25 to the extent possible. #435 ;-) Not suppress, but avoid generating it where we can.
Probably not in an application that embeds Jython (rather than runs Jython with the launcher or
javacommand). It's a thing you ask the JVM to tolerate. I don't know if that can be changed once running. The launcher has sprouted options necessary to tolerate some unsafe access in #435.Have you noticed the
jython-slimJAR which gives you more scope for choosing your own dependencies without shading?yogi1967 commentedon Jul 26, 2026
Thanks for replying... So I'm not sure where that leaves 2.7.4/5? Are you saying that this unsafe warning will somehow be eliminated in 2.7.5 (by somebody, somehow)? Or does someone have to do something? Thanks
jeff5 commentedon Jul 27, 2026
If your code or a dependency does something that raises such warnings, it is outside our scope to suppress it, and I think you ought to know anyway. However, we have made some code changes (in 2.7.4 I think) and are updating dependencies, including the Guava one, to avoid generating it where we can. So it's as fixed as it can be.
I think you still get it if you operate on a file handle in Windows.