@Inject
private IJvmModelAssociator associator;
protected void copyAndFixTypeParameters(List<JvmTypeParameter> typeParameters, JvmTypeParameterDeclarator target) {
for (JvmTypeParameter typeParameter : typeParameters) {
final JvmTypeParameter clonedTypeParameter = jvmTypesBuilder.cloneWithProxies(typeParameter);
if (clonedTypeParameter != null) {
target.getTypeParameters().add(clonedTypeParameter);
boolean upperBoundSeen = false;
for (JvmTypeConstraint constraint : clonedTypeParameter.getConstraints()) {
if (constraint instanceof JvmUpperBound) {
upperBoundSeen = true;
break;
}
}
if (!upperBoundSeen) {
JvmUpperBound upperBound = typesFactory.createJvmUpperBound();
upperBound.setTypeReference(typeReferences.getTypeForName(Object.class, typeParameter));
clonedTypeParameter.getConstraints().add(upperBound);
}
associator.associate(typeParameter, clonedTypeParameter);
}
}
}