List<ClassLoaderReference> () { if (myParentLoaders == null) { List<ClassLoaderReference> loaders = Collections.emptyList(); if (classLoader != null) { ClassType classLoaderClass = (ClassType)classLoader.referenceType(); while (classLoaderClass != null && !"java.lang.ClassLoader".equals(classLoaderClass.name())) { classLoaderClass = classLoaderClass.superclass(); } if (classLoaderClass != null) { Field parent = classLoaderClass.fieldByName("parent"); if (parent != null) { loaders = StreamEx.iterate( classLoader, Objects::nonNull, loader -> ObjectUtils.tryCast(loader.getValue(parent), ClassLoaderReference.class)) .toList(); } } } myParentLoaders = loaders; } return myParentLoaders; }