twitter/finagle — pull request #132 by okapies (2013-02-02 16:29:28+00:00)
Title: Makes the type parameter T of Cluster covariant

The following `update(changes)`, for example, will be compile error because the type parameter `[T]` of both `Cluster` and `Change` is invariant.

```
import java.net._
import com.twitter.concurrent.Spool
import com.twitter.finagle.builder._
import com.twitter.util.Future

def update(changes: Future[Spool[Cluster.Change[SocketAddress]]]) = ...
val (hosts, changes) = StaticCluster(List(new InetSocketAddress("192.168.0.1", 8080))).snap

update(changes)
// :18: error: type mismatch;
// found : com.twitter.util.Future[com.twitter.concurrent.Spool[com.twitter.finagle.builder.Cluster.Change[java.net.InetSocketAddress]]]
// required: com.twitter.util.Future[com.twitter.concurrent.Spool[com.twitter.finagle.builder.Cluster.Change[java.net.SocketAddress]]]
// update(changes)
// ^
```

Of course, this can be solved by specifying a type parameter of `StaticCluster`:

```
StaticCluster[SocketAddress](...)
```

but I think it is inconvenient.