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

STC: Guava Multimap#asMap bridge method

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.5.0, 3.0.5
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      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

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

                Dates

                • Created:
                  Updated: