Daniel Sun created GROOVY-12813:
-----------------------------------
Summary: STC: overloaded methods inherited through a generic
interface or class still pick the wrong overload
Key: GROOVY-12813
URL: https://issues.apache.org/jira/browse/GROOVY-12813
Project: Groovy
Issue Type: Bug
Components: Static compilation, Static Type Checker
Reporter: Daniel Sun
GROOVY-7204 and GROOVY-8059 were closed as Fixed (3.0.0-alpha-3 / 2.5.0-rc-3
and related versions). On master `ca71425976fd2e3da6db9634955ba0d39550a6d4`,
thirteen tests in `src/test/groovy/bugs/Groovy7204.groovy` are still
`@NotYetImplemented`. Neighbouring `testCompileStatic8` and
`testCompileStatic9` already run without the annotation.
The skipped methods are:
- `testTypeChecked1` / `testCompileStatic1` — `interface MyRepository extends
CrudRepository<String, Long>`
- `testTypeChecked2` / `testCompileStatic2` — the same shape with abstract
classes instead of interfaces
- `testTypeChecked3` / `testCompileStatic3` — an extra interface layer
(`MyRepository extends MyRepository2 extends CrudRepository<String, Long>`)
- `testTypeChecked4` / `testCompileStatic4` — an extra abstract-class layer
- `testTypeChecked5` / `testCompileStatic5` — mixed interface + abstract class
layers
- `testTypeChecked6` / `testCompileStatic6` — a concrete generic `Repository<T,
S extends Serializable>` (no interface)
- `testCompileStatic7` (also tagged GROOVY-8059) — `abstract class A<K extends
Serializable, V>` with `C extends A<String, Integer>` and
`obj.delete(Integer.valueOf(1))`
In each case the test calls `delete('foo')` (or the Integer overload) and
expects the `String` (resp. `Integer`) overload, not the `Long` / key overload.
Re-checked on 22 Nov 2026 (Asia/Taipei) at the same SHA by temporarily removing
@NotYetImplemented and running all 13 methods on JDK 17: every method still
fails. testTypeChecked1-6 and testCompileStatic1-6 still report "Cannot call
MyRepository#delete(java.lang.Long) with arguments [java.lang.String]" (or
Repository#delete for the *6 cases) at r.delete('foo'). testCompileStatic7
still reports "Cannot call C#delete(java.lang.String) with arguments
[java.lang.Integer]" at obj.delete(Integer.valueOf(1)).
**Acceptance criterion:** All thirteen methods pass under `@TypeChecked` and
`@CompileStatic` as written, and the `@NotYetImplemented` annotations are
removed.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)