So I've noticed that although everything compiles correctly, IntelliJ has
difficulty understanding the generics going on in the hierarchy of builder
classes. If you use methods from the parent in a chain, it returns the
wrong class, though this doesn't really matter to the compiled code due to
type erasure.

However, after much experimentation, I have figured out a rather monstrous
line of generics that works properly. Now bear with me as we explore the
dark depths of Java generics and fluent DSLs.

https://gist.github.com/jvz/dd499ccddfb6ffc0336fe0308e32b344

Yes, it looks absolutely ridiculous, but it avoids a lot of IDE problems
and more explicitly lays out the expectations of the builders themselves.
What do you think?

-- 
Matt Sicker <boa...@gmail.com>

Reply via email to