DEV Community

Discussion on: Self-Referential Generics in Java

Collapse
 
elmuerte profile image
Michiel Hendriks • Edited
class Serial<P> {
    // stores some identifier specific to P
}

interface Part<P> {
    Serial<P> getSerial();
}

This examples requires to be think about what it even means. Which puts it in the category of either: bad or, at best, avoid.

Collapse
 
neilgall profile image
Neil Gall

Agreed, and that's the easy part of all this code!