Hendrik said:
Thomas Fritsch schreef:
The <T> in Class<T> is the class it actually represents. So the Class
object belonging to YourClass is Class<YourClass>. This has all kinds
of advantages in making sure the right class object is given in method
arguments etc.
If a method returns Class<?>, this means it can return any Class object.
Ah, thanks! So Class<?> is pretty much the same as Class.
A somewhat related question:
How do I get the concrete semantic meaning of a <T> or <E> parameter
found in the javadoc class declaration? For example in:
public class Class<T> extends Object
public interface Collection<E> extends Iterable<E>
Surely we can make clever guesses about what the <T> or <E> parameter in
a particular class is intended to mean, by reading the javadoc of the
methods of that class. But shouldn't there be a more formal description,
too? Might be as a new javadoc tag, for example:
public class Class<T> extends Object
@genericparam T this class
public interface Collection<E> extends Iterable<E>
@genericparam E the type of objects contained in this Collection