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

   `ClassInfo.remove(Class)` no longer takes a class's default Groovy methods 
and extension methods with it. The next use of the class used to build a new 
`ClassInfo` without them, so after `ClassInfo.remove(StringBuilder)` the 
expression `sb << 'x'` could leave `sb` empty (it fell back to 
`CharSequence.leftShift`, which returns a new builder), and after the shutdown 
sweep shown in the integration guide `[1, 2, 3].collect { it * 2 }` threw 
`MissingMethodException`. The class now gets its previous `ClassInfo` back 
while that is still reachable, without the MetaClasses that were set for the 
class or its instances, and a discarded copy of Groovy is still released.
   
   This also makes `bugs.Groovy12363` pass when it runs after 
`bugs.Groovy12142` in the same test JVM: `Groovy12142` removes 
`StringBuilder`'s `ClassInfo`, and `Groovy12363` appends to a `StringBuilder` 
with `<<`.
   
   The guide's sweep is now a statically compiled method: written as dynamic 
Groovy and run by the copy it cleans up, it kept that copy's class loader 
reachable.
   
   Tests: four tests in `bugs.Groovy12142` for `ClassInfo.remove` and the 
documented sweep, beside a fifth that checks a discarded copy of Groovy is 
still released. The `groovy`, `gls`, `bugs` and `org.codehaus.groovy` packages 
pass (15,501 tests). The Checkstyle and CodeNarc gates pass. `bugs.Groovy12142` 
and `bugs.Groovy12363` also pass on JDK 17.
   
   This builds on #3095: the test of the guide's sweep needs it to pass on JDK 
17.
   
   Seen in 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