Description
Consider the following:
@Grab('com.google.guava:guava:30.1.1-jre') import com.google.common.collect.* @groovy.transform.TypeChecked void test() { ListMultimap<String, Integer> mmap = ArrayListMultimap.create() Map<String, Set<Integer>> map = mmap.asMap() // no STC error // ... }
Due to the presence of multiple bridge methods in ArrayListMultimap, generics checking of asMap() is currently lacking. The following are all bridge methods in ArrayListMultimap (30.1.1):
asMap() equals(Object) put(Object,Object) replaceValues(Object,Iterable) removeAll(Object) get(Object) forEach(BiConsumer) entries() values() clear() containsKey(Object) size() createCollection() // non-synthetic returns List not Collection toString() hashCode() keys() keySet() putAll(Multimap) putAll(Object,Iterable) remove(Object,Object) containsEntry(Object,Object) containsValue(Object) isEmpty()
Attachments
Issue Links
- is a clone of
-
GROOVY-8638 CompileStatic fails with Guava Multimap#asMap
- Closed
- relates to
-
GROOVY-10109 IllegalAccessError with package-access base class
- Closed
-
GROOVY-11012 Wrong type is inferred when calling method defined in the parent class
- Closed
-
GROOVY-11035 Inferred type is Object when having a complex inheritance chain of interfaces
- Closed