MasterDefRegistry registry = Aura.getDefinitionService().getDefRegistry();
if (extendsDescriptor != null) {
T parentDef = extendsDescriptor.getDef();
if (parentDef == null) {
throw new DefinitionNotFoundException(extendsDescriptor, getLocation());
}
if (parentDef.getDescriptor().equals(descriptor)) {
throw new InvalidDefinitionException(String.format(
"%s cannot extend itself", getDescriptor()), getLocation());
}
if (!parentDef.isExtensible()) {
throw new InvalidDefinitionException(String.format(
"%s cannot extend non-extensible component %s", getDescriptor(), extendsDescriptor),
getLocation());
}
registry.assertAccess(descriptor, parentDef);
SupportLevel support = getSupport();
DefDescriptor<T> extDesc = extendsDescriptor;
while (extDesc != null) {
T extDef = extDesc.getDef();
if (support.ordinal() > extDef.getSupport().ordinal()) {
throw new InvalidDefinitionException(
String.format("%s cannot widen the support level to %s from %s's level of %s",
getDescriptor(),
support, extDesc, extDef.getSupport()), getLocation());
}
extDesc = (DefDescriptor<T>) extDef.getExtendsDescriptor();
}
}
for (DefDescriptor<InterfaceDef> intf : interfaces) {
InterfaceDef interfaze = intf.getDef();
if (interfaze == null) {
throw new DefinitionNotFoundException(intf, getLocation());
}
registry.assertAccess(descriptor, interfaze);
}