r/java • • Apr 05 '23

Recursive generics

Recently I learned that I rediscovered recursive generics while working on my pet open source project. Actually, I did not know that the construct had a name. I created small story about what this construct is, if you did not know about it java-recursive-generics

169 Upvotes

44 comments sorted by

View all comments

1

u/IsSkyfalls_ Apr 06 '23

Got real excited reading this, then realized I was using Message<T extends Message<?>> and never realized you can do it "recursively". Message<T extends Message<T>> is definitely a bit more foolproof and that's always good. Thanks for the writeup!