Daniel Sun created GROOVY-12818:
-----------------------------------
Summary: STC: ArrayListMultimap#asMap() still loses generics when
the receiver has a class type
Key: GROOVY-12818
URL: https://issues.apache.org/jira/browse/GROOVY-12818
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Daniel Sun
GROOVY-10120 (Closed/Fixed in 4.0.5 / 3.0.13 / 2.5.19) concerned STC handling
of Guava `Multimap#asMap` bridge methods.
`groovy.transform.stc.GenericsSTCTest#testReturnTypeInferenceWithMethodGenerics18b`
in `src/test/groovy/groovy/transform/stc/GenericsSTCTest.groovy` is still
`@NotYetImplemented`. With `ListMultimap<String, Integer> mmap =
ArrayListMultimap.create()`, assigning `mmap.asMap()` to `Map<String,
Set<Integer>>` should be rejected (`Collection` vs `Set`), but the bridge
method still lacks usable generics. The comment in the test is:
`ArrayListMultimap#asMap() is bridge and lacks generics`.
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.
@Grab('com.google.guava:guava:31.1-jre') succeeded. The test expected an STC
error assigning ArrayListMultimap#asMap() (Map<String, Collection<Integer>>) to
Map<String, Set<Integer>>, but compilation succeeded. Generics are still lost /
not checked when the receiver has a class type.
**Acceptance criterion:** The assignment is rejected with the same kind of
diagnostic as `18a`, and `@NotYetImplemented` is removed.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)