final EasyBeansEjbJarClassMetadata visitingClassAnnotationMetadata) throws ResolverException {
String superClass = visitingClassAnnotationMetadata.getSuperName();
if (superClass != null) {
// try to see if it was analyzed (and not java.lang.Object)
if (!superClass.equals(JAVA_LANG_OBJECT)) {
EasyBeansEjbJarClassMetadata superMetadata = beanClassAnnotationMetadata.getLinkedClassMetadata(superClass);
if (superMetadata == null) {
throw new IllegalStateException("No super class named '" + superClass
+ "' was analyzed. But it is referenced from '" + visitingClassAnnotationMetadata.getClassName()
+ "'.");
}
// Add in a new list the existing interfaces
List<String> newInterfacesLst = new ArrayList<String>();
String[] currentInterfaces = beanClassAnnotationMetadata.getInterfaces();
if (currentInterfaces != null) {
for (String itf : currentInterfaces) {
newInterfacesLst.add(itf);
}
}
// Add the interfaces of the super class only if there aren't
// yet present
String[] superInterfaces = superMetadata.getInterfaces();
List<String> inheritedInterfaces = beanClassAnnotationMetadata.getInheritedInterfaces();
if (superInterfaces != null) {
for (String itf : superInterfaces) {
if (!inheritedInterfaces.contains(itf) && !newInterfacesLst.contains(itf)) {
inheritedInterfaces.add(itf);
}
if (!newInterfacesLst.contains(itf)) {
newInterfacesLst.add(itf);
}
}
}
// Set the updated list.
beanClassAnnotationMetadata.setInterfaces(newInterfacesLst.toArray(new String[newInterfacesLst.size()]));
beanClassAnnotationMetadata.setInheritedInterfaces(inheritedInterfaces);
// The local and remote interfaces need to be reported from the superclass to the current class.
// Start with the local interfaces.
IJLocal currentLocalInterfaces = beanClassAnnotationMetadata.getLocalInterfaces();
IJLocal superLocalInterfaces = superMetadata.getLocalInterfaces();
if (superLocalInterfaces != null) {
if (currentLocalInterfaces == null) {
currentLocalInterfaces = new JLocal();
beanClassAnnotationMetadata.setLocalInterfaces(currentLocalInterfaces);
}
for (String itf : superLocalInterfaces.getInterfaces()) {
if (!currentLocalInterfaces.getInterfaces().contains(itf)) {
currentLocalInterfaces.addInterface(itf);
}
}
}
// And then, with the remote interfaces
IJRemote currentRemoteInterfaces = beanClassAnnotationMetadata.getRemoteInterfaces();
IJRemote superRemoteInterfaces = superMetadata.getRemoteInterfaces();
if (superRemoteInterfaces != null) {
if (currentRemoteInterfaces == null) {
currentRemoteInterfaces = new JRemote();
beanClassAnnotationMetadata.setRemoteInterfaces(currentRemoteInterfaces);
}
for (String itf : superRemoteInterfaces.getInterfaces()) {
if (!currentRemoteInterfaces.getInterfaces().contains(itf)) {
currentRemoteInterfaces.addInterface(itf);
}
}
}
// Loop again until java.lang.Object super class is found
if (!superMetadata.getClassName().equals(JAVA_LANG_OBJECT)) {
loop(beanClassAnnotationMetadata, superMetadata);
}
}
}
}