Note that Integer.TYPE and Integer.class are Class<Integer> , Double.TYPE and Double.class are equal to Class<Double> and how you use autoboxing to convert between int and Integer , as well as double and double . The question is, is this true for void : Void.TYPE and Void.class both Void.class , but can you "convert" between void and void ?
In other words, suppose you have this interface:
public interface Foo<T> { public T doSomething(); }
A class that implements Foo<Integer> can return an int in its doSomething() implementation when an int is marked. Similarly for Foo<Double> return double . So, for a Foo<Void> : since a valid void valid, it is null (unless you make a weird reflection that is rarely justified), does that mean you can omit the required return null , is void boxing effective?
source share