codeconsole opened a new pull request, #3095:
URL: https://github.com/apache/groovy/pull/3095

   On JDK 17, linking a call site no longer leaves the call site's types in the 
`asType` cache of a method handle that outlives it: the JDK's shared identity 
handle (used for casts) and argument collector (used by `catchException`), and 
the runtime's static guard and filter handles. JDK 17 keeps that cache 
strongly, so a cast to a class of a discarded script or Groovy copy kept its 
class loader reachable. JDK 18 and later take the unchanged path.
   
   On JDK 17 these conversions are now made on a new handle that invokes the 
long-lived one and that only the call site holds, and `catchException` is 
applied to the target with its reference types erased (after making a varargs 
target fixed arity), so the JDK's collector is converted to a type of JDK 
classes only.
   
   Tests: 
`bugs.Groovy12142.testDynamicCallsKeepNoDiscardedScriptLoaderReachable` runs a 
script with casts, typed receivers, null arguments, null-safe calls and a 
failing call in a `GroovyClassLoader` and checks that the loader is collected 
once dropped; it fails on JDK 17 without the change. The `groovy`, `gls`, 
`bugs` and `org.codehaus.groovy` packages pass (15,496 tests). The Checkstyle 
and CodeNarc gates pass. `bugs.Groovy12142` also passes on JDK 17.
   
   Seen on JDK 17 with 4.0.33, 5.0.8 and 6.0.0.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to