There are some similar horrors in the source code for Clojure. https://github.com/clojure/clojure/blob/master/src/jvm/cloju...
Java is a harsh mistress. This is why dynamic languages on the JVM are nice, so I never have to write code like this myself.