What does <? super Void> mean?

  • A+
Category:Languages

I have encountered this class in code that I'm maintaining:

new GenericFutureListener<Future<? super Void>>() {...} 

I'm having a really hard time understanding what this means. A Future containing a type that is either Void or its superclass - Object. So why not just write Future<Object>?

 


It looks like this is being created to conform to some generic type like GenericFutureListener<Future<? super T>>, which is not flexible enough to allow for GenericFutureListener<Future<Void>> alone.

For instance if you have something like this:

class GenericFutureListener<T> {}  public static <T> void m(GenericFutureListener<Future<? super T>> p) {     ... } 
m(new GenericFutureListener<Future<? super Void>>() {}); // works, m(new GenericFutureListener<Future<Void>>() {}); // does not work 

Passing in just a GenericFutureListener<Future<Void>> is not allowed.

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: