import java.util.*;

class Bug2 {
  /* This method just emulates the common Google Guava/Guice pattern to wrap collections, e.g.
   * <http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Iterators.html#peekingIterator(java.util.Iterator)>
   */
  static <V> Set<V> asSet(Collection<? extends V> collection) { 
    return new HashSet<V>(collection);
  }
  
  // this causes the bug -> type is inferred by parameter not left side assignment
  static <V> void bug(Collection<? extends V> collection) {
    Set<V> set1 = Bug2.asSet(collection);
    // workaround that compiles:
    Set<V> set2 = Bug2.<V>asSet(collection);
  }
}

