public JvmTypeReference getCommonParameterSuperType(final List<JvmTypeReference> types, List<JvmTypeReference> initiallyRequested) { Function<JvmTypeReference, String> getCanonicalName = new Function<JvmTypeReference, String>() { public String apply(JvmTypeReference from) { return from.getIdentifier(); } }; Set<String> allNames = Sets.newHashSet(Iterables.transform(types, getCanonicalName)); if (allNames.size() == 1) return types.get(0); if (types.size() == initiallyRequested.size()) { Set<String> initiallyRequestedNames = Sets.newHashSet(Iterables.transform(initiallyRequested, getCanonicalName)); if (initiallyRequestedNames.equals(allNames)) { // recursion - return object wildcard JvmTypeReference objectTypeReference = typeReferences.getTypeForName(Object.class, types.get(0).getType()); return typeReferences.wildCardExtends(objectTypeReference); } } JvmTypeReference superType = getCommonSuperType(types); if (superType instanceof JvmWildcardTypeReference) return superType; JvmWildcardTypeReference wildcardTypeReference = factory.createJvmWildcardTypeReference(); if (superType != null) { JvmUpperBound upperBound = factory.createJvmUpperBound(); upperBound.setTypeReference(EcoreUtil2.clone(superType)); wildcardTypeReference.getConstraints().add(upperBound); } return wildcardTypeReference; }
JvmTypeReference reference = null; if (!uppers.isEmpty() && upperIndex < lowerIndex) { reference = conformanceComputer.getCommonSuperType(uppers); if (uppers.size() == 1 && boundToList.get(upperIndex).kind == ResolveInfoKind.WC_UPPER) { boolean useWildcard = true; if (bestResolvedLower.kind != ResolveInfoKind.WC_LOWER) { if (!uppers.isEmpty()) { JvmTypeReference upper = conformanceComputer.getCommonSuperType(uppers); if (conformanceComputer.isConformant(bestResolvedLower.reference, upper)) reference = upper; reference = bestResolvedLower.reference; if (!uppers.isEmpty()) { JvmTypeReference upper = conformanceComputer.getCommonSuperType(uppers); if (conformanceComputer.isConformant(reference, upper)) reference = upper;
JvmTypeReference commonVarArgType = getConformanceComputer().getCommonSuperType(actualVarArgTypes); resolveAgainstActualType(varArgComponentType, commonVarArgType, result, true, paramCount);
if (withoutPrimitives.equals(types)) return null; return getCommonSuperType(withoutPrimitives);