visibleClassesCache = new ArrayList();
// refer to getClassLoaderClasses in jvmtiGetLoadedClasses.cpp
// a. SystemDictionary::classes_do doesn't include arrays of primitive types (any dimensions)
SystemDictionary sysDict = getSystemDictionary();
sysDict.classesDo(
new SystemDictionary.ClassAndLoaderVisitor() {
public void visit(Klass k, Oop loader) {
if (ref().equals(loader)) {
for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
visibleClassesCache.add(vm.referenceType(l));
}
}
}
}
);
// b. multi dimensional arrays of primitive types
sysDict.primArrayClassesDo(
new SystemDictionary.ClassAndLoaderVisitor() {
public void visit(Klass k, Oop loader) {
if (ref().equals(loader)) {
visibleClassesCache.add(vm.referenceType(k));
}