I was unlucky enough to hit a compiler bug, such that Eclipse IDE passes compilation, but it failed on my server using ant with Sun’s compiler. From the bug report it happens to JDK6 and will only be fixed in JDK7, so in the meantime I read of 2 workarounds that work.
1. Up-cast to an Object so that the down-cast become compiler-legal.
2. Use the Class.cast() method.
ChildType.class.cast( getParentType() );