OK, I moved the check to CompilationStateBuilder.addArchive()
I thought that would help get rid of the CachedCompilationUnit cast, but its not so easy. A CompilationUnitArchive holds a mix of unit types before it is serialized, and CachedCompilationUnits exclusively after it has been read back. So the code isn't going to fail, but it isn't obvious at a quick read why its safe. We could get rid of the cast by going back and deciding how to implement getSerializedTypesVersion() (we took a shortcut and only implemeneted it for CCU) http://gwt-code-reviews.appspot.com/1464804/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
