I don't really understand.
If the class references the annotations then all you need to do is make sure
you have something like:
| WeakHashMap<Class<?>, WeakValueHashMap<List<Annotation>,
Whatever>>
|
You then need to do a double lookup
Pseudo code (need to check nulls):
| Whatever w = map.get(clazz).get(annotations);
|
This will basically remove the reference when either the initial class or the
"Whatever" instance is GCed.
It don't think it really matters if you have hard refernces on the Annotations
classes
in the List since that will also be true while the original Class/ClassLoader or
Whatever holds references?
Of course if you really want to be safe, you could try to create a
WeakCompositeKeyHashMap
which removes the entry when any of the elements in the composite key
gets GCed.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152054#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...