Block constructorBody = new Block();
for (int i = 0, n = dc.getArity(); i < n; ++i) {
FieldName fn = (FieldName)dc.getNthFieldName(i);
JavaTypeName type = (JavaTypeName)dci.fieldTypeNames.get(fn);
String fieldName = (String)typeConstructorInfo.fieldJavaNames.get(fn);
String argName = fieldName+"$";
argNames[i] = argName;
argTypes[i] = type;
if (!typeConstructorInfo.commonFieldNames.contains(fn)) {
JavaExpression.JavaField.Instance field =
new JavaExpression.JavaField.Instance(null, fieldName, type);
JavaExpression assign = new Assignment (field, new MethodVariable(argName));
constructorBody.addStatement(new ExpressionStatement(assign));
}
}
String constructorName = dcClassTypeName.getUnqualifiedJavaSourceName();
int index = constructorName.lastIndexOf('.');
if (index > -1) {
constructorName = constructorName.substring(index + 1);
}
JavaConstructor constructor;
if (typeConstructorInfo.commonFieldNames.size() > 0) {
JavaExpression superArgValues[] = new JavaExpression[typeConstructorInfo.commonFieldNames.size()];
JavaTypeName superArgTypes[] = new JavaTypeName[superArgValues.length];
int i = 0;
for (FieldName superFieldName : typeConstructorInfo.commonFieldNames) {
JavaTypeName fieldType = (JavaTypeName)dci.fieldTypeNames.get(superFieldName);
String fieldName = (String)typeConstructorInfo.fieldJavaNames.get(superFieldName);
String argName = fieldName+"$";
JavaExpression superArgValue = new MethodVariable(argName);
superArgValues[i] = superArgValue;
superArgTypes[i] = fieldType;