for (AttributeDefRef facet : this.facets) {
facet.validateReferences();
}
// TODO: lots more validation an stuff!!!!!!! #W-689596
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);
}
for (RegisterEventDef def : events.values()) {
def.validateReferences();
}
for (EventHandlerDef def : eventHandlers) {
def.validateReferences();
}
for (ImportDef def : imports) {
def.validateReferences();
}
// have to do all sorts of craaaazy checks here for dupes and matches
// and bah
validateExpressionRefs();
for (ClientLibraryDef def : this.clientLibraries) {
def.validateReferences();
registry.assertAccess(descriptor, def);
}
}