This will still break occasionally if there is a hash collision. It won't happen very often, but we should try and find a better way to do this. 

One option would be to use a Map<ClassLoader, Integer> to map the CL to a unique integer, but we would have to be very careful this does not leak class loaders.