The full picture
abstract class Request<SELF extends Request<SELF>> {
String url;
@SuppressWarnings("unchecked")
SELF url(String u) { this.url = u; return (SELF) this; }
}
final class JsonRequest extends Request<JsonRequest> {
JsonRequest body(Object o) { …; return this; }
}
// Fluent chain keeps the SUBtype — no casts, order-independent:
new JsonRequest().url("/orders").body(dto); // url() returned JsonRequest ✅<T extends Comparable<? super T>>— the canonical 'max' bound: allowsTto inherit its comparability from a supertype (e.g.,java.sql.Timestampcomparing asjava.util.Date).- Intersection bounds:
<T extends Runnable & AutoCloseable>demand multiple capabilities without a new interface. - Type tokens (
Class<T>) + bounded factories give type-safe heterogeneous containers —<T> T getInstance(Class<T> type)in DI containers is exactly this.