Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10120

STC: Guava Multimap#asMap bridge method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.0, 3.0.5
    • 4.0.5, 2.5.19, 3.0.13
    • None
    • None

    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

          Activity

            People

              emilles Eric Milles
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: