* @param argumentTypes the types with which the parameters are to be replaced
* @return the implicit constructor that was created
*/
private ConstructorElement createImplicitContructor(InterfaceType classType,
ConstructorElement explicitConstructor, Type[] parameterTypes, Type[] argumentTypes) {
ConstructorElementImpl implicitConstructor = new ConstructorElementImpl(
explicitConstructor.getName(),
-1);
implicitConstructor.setSynthetic(true);
implicitConstructor.setRedirectedConstructor(explicitConstructor);
implicitConstructor.setConst(explicitConstructor.isConst());
implicitConstructor.setReturnType(classType);
ParameterElement[] explicitParameters = explicitConstructor.getParameters();
int count = explicitParameters.length;
if (count > 0) {
ParameterElement[] implicitParameters = new ParameterElement[count];
for (int i = 0; i < count; i++) {
ParameterElement explicitParameter = explicitParameters[i];
ParameterElementImpl implicitParameter = new ParameterElementImpl(
explicitParameter.getName(),
-1);
implicitParameter.setConst(explicitParameter.isConst());
implicitParameter.setFinal(explicitParameter.isFinal());
implicitParameter.setParameterKind(explicitParameter.getParameterKind());
implicitParameter.setSynthetic(true);
implicitParameter.setType(explicitParameter.getType().substitute(
argumentTypes,
parameterTypes));
implicitParameters[i] = implicitParameter;
}
implicitConstructor.setParameters(implicitParameters);
}
FunctionTypeImpl type = new FunctionTypeImpl(implicitConstructor);
type.setTypeArguments(classType.getTypeArguments());
implicitConstructor.setType(type);
return implicitConstructor;
}