[ 
https://issues.apache.org/jira/browse/GROOVY-12580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135604#comment-18135604
 ] 

ASF GitHub Bot commented on GROOVY-12580:
-----------------------------------------

testlens-app[bot] commented on PR #3096:
URL: https://github.com/apache/groovy/pull/3096#issuecomment-6539724920

   ## 🚨 All tests passed but jobs failed 🚨
   
   ### Failed Jobs without Test Failures
   
   ❌ [Build and test / lts \(17, 
macos-latest\)](https://github.com/apache/groovy/actions/runs/41169508385/job/124444206710?pr=3096)
   ❌ [Build and test / lts \(17, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41169508385/job/124444206720?pr=3096)
   ❌ [Build and test / lts \(17, windows-latest, 
1\)](https://github.com/apache/groovy/actions/runs/41169508385/job/124444206776?pr=3096)
   ❌ [Build and test / lts \(25, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41169508385/job/124444206754?pr=3096)
   
   🏷️ Commit: 2b6b24e87260b94e897c495c18343fd30e8eb093
   ▶️ Tests:  43819 executed
   ⚪️ Checks: 27/27 completed
   
   ### Rerun Controls
   
   Click the checkbox to trigger a rerun:
   
   - [ ] **Rerun jobs**
   
   ---
   _Learn more about TestLens at 
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
   




> ClassInfo.remove takes a class's default Groovy methods with it
> ---------------------------------------------------------------
>
>                 Key: GROOVY-12580
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12580
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 4.0.33, 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {{ClassInfo.remove(Class)}} drops the class's association, and the next use 
> of the class creates a new {{ClassInfo}}. The default Groovy methods and 
> extension methods of a class are written into its {{ClassInfo}} once, by the 
> registry at startup, so the class loses them for the rest of the runtime's 
> life:
> {code:groovy}
> import org.codehaus.groovy.reflection.ClassInfo
> ClassInfo.remove(StringBuilder)
> def sb = new StringBuilder('ab')
> sb[0..0] = 'z' // MissingMethodException: No signature of method: putAt for 
> class: java.lang.StringBuilder
> {code}
> {{sb << 'x'}} falls back to {{CharSequence.leftShift}}, which returns a new 
> builder and leaves {{sb}} empty, or to {{Appendable.leftShift}}, depending on 
> hash order. After the sweep the integration guide documents for application 
> shutdown, a runtime still in use loses every default Groovy method:
> {code:groovy}
> import org.codehaus.groovy.reflection.ClassInfo
> for (ClassInfo ci : ClassInfo.getAllClassInfo()) { Class<?> c = 
> ci.getTheClass(); if (c != null) ClassInfo.remove(c) }
> [1, 2, 3].collect { it * 2 } // MissingMethodException: No signature of 
> method: multiply for class: java.lang.Integer
> {code}
> {{bugs.Groovy12142.testClassInfoRemoveSweepIsSafeToRunRepeatedly}} removes 
> the {{ClassInfo}} of {{StringBuilder}}, so {{bugs.Groovy12363}}, whose 
> anonymous class does {{sink << who}}, fails when it runs later in the same 
> test JVM.
> The guide's sweep, written as dynamic Groovy and run by the copy it cleans 
> up, also keeps that copy's class loader reachable, since a dynamic call made 
> after the first removal associates a class with that runtime again.
> PR: https://github.com/apache/groovy/pull/3096



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to