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.