diff --git a/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java b/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java index daf30a2..9f1f26a 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithms/CodeGenerator.java @@ -72,8 +72,10 @@ codes.add("public class " + type.getTypeName() + "{"); for (FieldDeclaration field : type.getFields()) { if (type.getTypeName() != "Main") { - codes.add("\t" + "private " + field.getType().getImplementationTypeName() + " " + field.getName() - + ";"); + String cons = "\t" + "private " + field.getType().getImplementationTypeName() + " " + field.getName(); + if(field.getType().equals(DataConstraintModel.typeList)) cons += " = new ArrayList<>()"; + cons += ";"; + codes.add(cons); } else { String cons = "\t" + "private " + field.getType().getImplementationTypeName() + " " + field.getName() + " = new " + field.getType().getTypeName() + "("; @@ -110,9 +112,9 @@ } } codes.add("\t" + "}"); + codes.add(""); } } - codes.add(""); for (MethodDeclaration method : type.getMethods()) { String varstr = "\t" + "public " + method.getReturnType().getImplementationTypeName() + " " + method.getName() + "(";