Stronger Typings for Smarter Recompilation of Java-like Languages