Daniel Sun created GROOVY-12810:
-----------------------------------

             Summary: A same-named static method still hides 
Class.getSuperclass() after a DelegatingMetaClass is installed
                 Key: GROOVY-12810
                 URL: https://issues.apache.org/jira/browse/GROOVY-12810
             Project: Groovy
          Issue Type: Bug
          Components: groovy-runtime
            Reporter: Daniel Sun


GROOVY-4097 (Closed/Fixed, no fixVersion recorded) addressed MOP method 
selection involving `Class` objects. On current master, 
`bugs.Groovy4097#testMethodSelection2` in 
`src/test/groovy/bugs/Groovy4097.groovy` is still `@NotYetImplemented`. It 
defines `class C extends A { static String getSuperclass() { ... } }`, installs 
a `DelegatingMetaClass` on `C`, and asserts `c.getClass().getSuperclass() == 
A.class` — that is, the reflective `Class` method, not `C.getSuperclass()`.

Scanned SHA: `ca71425976fd2e3da6db9634955ba0d39550a6d4`.

Re-checked on 22 Nov 2026 (Asia/Taipei) at the same SHA by temporarily removing 
@NotYetImplemented and running the test on JDK 17: it still fails. assert 
cls.getSuperclass() == A.class failed because getSuperclass() returned "This 
was the wrong method" (class C). A same-named static method still hides 
Class.getSuperclass() after a DelegatingMetaClass is installed.

**Acceptance criterion:** The assertion holds under a `DelegatingMetaClass`, 
and the annotation is removed.



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

Reply via email to