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.
(ChildType)(Object)getParentType();
2. Use the Class.cast() method.
ChildType.class.cast( getParentType() );
Excellento!!!!.
Bless you, my friend! You just solved my fatal problem 🙂
Thank you!!!! Spent hours trying to find out what was wrong with my code!!