private void populateSCIsForCacheEntry(JavaClassCacheEntry cacheEntry) {
Set<ServletContainerInitializer> result =
new HashSet<ServletContainerInitializer>();
JavaClass javaClass = cacheEntry.getJavaClass();
// Super class
String superClassName = javaClass.getSuperclassName();
JavaClassCacheEntry superClassCacheEntry =
javaClassCache.get(superClassName);
// Avoid an infinite loop with java.lang.Object
if (cacheEntry.equals(superClassCacheEntry)) {
cacheEntry.setSciSet(new HashSet<ServletContainerInitializer>());
return;
}
// May be null of the class is not present or could not be loaded.
if (superClassCacheEntry != null) {
if (superClassCacheEntry.getSciSet() == null) {
populateSCIsForCacheEntry(superClassCacheEntry);
}
result.addAll(superClassCacheEntry.getSciSet());
}
result.addAll(getSCIsForClass(superClassName));
// Interfaces
for (String interfaceName : javaClass.getInterfaceNames()) {
JavaClassCacheEntry interfaceEntry =
javaClassCache.get(interfaceName);
// A null could mean that the class not present in application or
// that there is nothing of interest. Either way, nothing to do here
// so move along