use of org.eclipse.xtext.xbase.typesystem.override.IResolvedExecutable in project xtext-xtend by eclipse.
the class XtendValidator method doCheckDuplicateExecutables.
protected <Executable extends IResolvedExecutable> void doCheckDuplicateExecutables(JvmGenericType inferredType, List<Executable> declaredOperations, Function<String, List<Executable>> bySignature, Set<EObject> flaggedOperations) {
Set<Executable> processed = Sets.newHashSet();
for (Executable declaredExecutable : declaredOperations) {
if (!processed.contains(declaredExecutable)) {
List<Executable> sameErasure = bySignature.apply(declaredExecutable.getResolvedErasureSignature());
if (sameErasure.size() > 1) {
Multimap<String, Executable> perSignature = HashMultimap.create(sameErasure.size(), 2);
outer: for (Executable executable : sameErasure) {
for (LightweightTypeReference parameterType : executable.getResolvedParameterTypes()) {
if (parameterType.isUnknown())
continue outer;
}
perSignature.put(executable.getResolvedSignature(), executable);
}
if (perSignature.size() > 1) {
for (Collection<Executable> sameSignature : perSignature.asMap().values()) {
for (Executable operationWithSameSignature : sameSignature) {
JvmExecutable executable = operationWithSameSignature.getDeclaration();
EObject otherSource = associations.getPrimarySourceElement(executable);
if (flaggedOperations.add(otherSource)) {
if (sameSignature.size() > 1) {
error("Duplicate " + typeLabel(executable) + " " + operationWithSameSignature.getSimpleSignature() + " in type " + inferredType.getSimpleName(), otherSource, nameFeature(otherSource), DUPLICATE_METHOD);
} else {
error("The " + typeLabel(executable) + " " + operationWithSameSignature.getSimpleSignature() + " has the same erasure " + operationWithSameSignature.getResolvedErasureSignature() + " as another " + typeLabel(executable) + " in type " + inferredType.getSimpleName(), otherSource, nameFeature(otherSource), DUPLICATE_METHOD);
}
}
}
}
}
}
}
}
}
use of org.eclipse.xtext.xbase.typesystem.override.IResolvedExecutable in project xtext-xtend by eclipse.
the class ImplementMemberFromSuperAssist method createOverrideProposals.
public void createOverrideProposals(XtendTypeDeclaration model, ContentAssistContext context, ICompletionProposalAcceptor acceptor, IProposalConflictHelper conflictHelper) {
final JvmDeclaredType inferredType = associations.getInferredType(model);
List<IResolvedExecutable> overrideables = overrideProposalUtil.getImplementationCandidates(inferredType, model.isAnonymous());
for (IResolvedExecutable overrideable : overrideables) {
ICompletionProposal completionProposal = createOverrideMethodProposal(model, overrideable, context, conflictHelper);
if (completionProposal != null)
acceptor.accept(completionProposal);
}
}
Aggregations