else if(parent.eClass() == PPPackage.Literals.LITERAL_NAME_OR_REFERENCE)
parentString = ((LiteralNameOrReference) parent).getValue();
if(parentString == null || parentString.length() < 1)
return;
SearchResult searchResult = ppFinder.findHostClasses(o, parentString, importedNames);
List<IEObjectDescription> descs = searchResult.getAdjusted();
if(descs.size() > 0) {
// make list only contain unique references
descs = Lists.newArrayList(Sets.newHashSet(descs));
CrossReferenceAdapter.set(parent, descs);
// record resolution at resource level
importedNames.addResolved(descs);
if(descs.size() > 1) {
// this is an ambiguous link - multiple targets available and order depends on the
// order at runtime (may not be the same).
importedNames.addAmbiguous(descs);
acceptor.acceptWarning(
"Ambiguous reference to: '" + parentString + "' found in: " +
visibleResourceList(o.eResource(), descs), o,
PPPackage.Literals.HOST_CLASS_DEFINITION__PARENT,
IPPDiagnostics.ISSUE__RESOURCE_AMBIGUOUS_REFERENCE,
proposer.computeDistinctProposals(parentString, descs));
}
// must check for circularity
List<QualifiedName> visited = Lists.newArrayList();
visited.add(converter.toQualifiedName(o.getClassName()));
checkCircularInheritence(o, descs, visited, acceptor, importedNames);
}
else if(searchResult.getRaw().size() > 0) {
List<IEObjectDescription> raw = searchResult.getRaw();
CrossReferenceAdapter.set(parent, raw);
// Sort of ok, it is not on the current path
// record resolution at resource level, so recompile knows about the dependencies
importedNames.addResolved(raw);
acceptor.acceptWarning(
"Found outside current search path: '" + parentString + "'", o,
PPPackage.Literals.HOST_CLASS_DEFINITION__PARENT, IPPDiagnostics.ISSUE__NOT_ON_PATH);
}
else {
// record unresolved name at resource level
addUnresolved(
importedNames, converter.toQualifiedName(parentString), NodeModelUtils.findActualNodeFor(parent));
// importedNames.addUnresolved(converter.toQualifiedName(parentString));
CrossReferenceAdapter.clear(parent);
// ... and finally, if there was neither a type nor a definition reference
String[] proposals = proposer.computeProposals(
parentString, ppFinder.getExportedDescriptions(), searchPath, CLASS_AND_TYPE);
acceptor.acceptError(
"Unknown class: '" + parentString + "'", o, //
PPPackage.Literals.HOST_CLASS_DEFINITION__PARENT,
proposalIssue(IPPDiagnostics.ISSUE__RESOURCE_UNKNOWN_TYPE, proposals), //
proposals);
}
if(!advisor().allowInheritanceFromParameterizedClass()) {
List<IEObjectDescription> targets = descs.size() > 0
? descs
: searchResult.getRaw();
if(targets.size() > 0) {
IEObjectDescription target = targets.get(0);
if(target.getUserData(PPDSLConstants.CLASS_ARG_COUNT) != null)
acceptor.acceptError(
"Can not inherit from a parameterized class in Puppet versions < 3.0.", o, //