use of org.jikesrvm.util.ImmutableEntryHashSetRVM in project JikesRVM by JikesRVM.
the class InterfaceHierarchy method allSubClasses.
/**
* @param C an interface
* @return the set of all classes known to extend C
*/
private static ImmutableEntryHashSetRVM<RVMClass> allSubClasses(RVMClass C) {
ImmutableEntryHashSetRVM<RVMClass> result = new ImmutableEntryHashSetRVM<RVMClass>(5);
// also add any classes that implement a sub-interface of I.
for (RVMClass subClass : C.getSubClasses()) {
result.add(subClass);
result.addAll(allSubClasses(subClass));
}
return result;
}
use of org.jikesrvm.util.ImmutableEntryHashSetRVM in project JikesRVM by JikesRVM.
the class InterfaceHierarchy method allImplementors.
/**
* @return the set of all classes known to implement the interface
* @param I the implemented interface
*/
private static ImmutableEntryHashSetRVM<RVMClass> allImplementors(RVMClass I) {
// get the set of classes registered as implementing I
ImmutableEntryHashSetRVM<RVMClass> result = findOrCreateSet(I);
// need to do this kludge to avoid recursive concurrent modification
for (RVMClass subClass : I.getSubClasses()) {
result.addAll(allImplementors(subClass));
}
// also add any sub-classes of these classes.
// need to cache additions to avoid modifying the set while iterating
ImmutableEntryHashSetRVM<RVMClass> toAdd = new ImmutableEntryHashSetRVM<RVMClass>(5);
for (RVMClass c : result) {
toAdd.addAll(allSubClasses(c));
}
result.addAll(toAdd);
return result;
}
Aggregations