I think we cannot simply use the class instead of the class name. The major issue is that in Weld all AnnotatedTypes are cached in a map (and no cleanup is performed at runtime). And so the map would grow indefinitely (this can be solved by setting some limit) and the outdated cache items would also prevent the original class and it's ClassLoader to be garbage collected.
However, we could probably overwrite the "old" AnnotatedType if the new java class does not equal the old one. I'm going to test a prototype tomorrow.
|