private Statement createConstructorStatement(
     ClassNode cNode,
     PropertyNode pNode,
     List<String> knownImmutableClasses,
     List<String> knownImmutables) {
   FieldNode fNode = pNode.getField();
   final ClassNode fieldType = fNode.getType();
   Statement statement = null;
   if (fieldType.isArray() || isOrImplements(fieldType, CLONEABLE_TYPE)) {
     statement = createConstructorStatementArrayOrCloneable(fNode);
   } else if (isKnownImmutableClass(fieldType, knownImmutableClasses)
       || isKnownImmutable(pNode.getName(), knownImmutables)) {
     statement = createConstructorStatementDefault(fNode);
   } else if (fieldType.isDerivedFrom(DATE_TYPE)) {
     statement = createConstructorStatementDate(fNode);
   } else if (isOrImplements(fieldType, COLLECTION_TYPE)
       || fieldType.isDerivedFrom(COLLECTION_TYPE)
       || isOrImplements(fieldType, MAP_TYPE)
       || fieldType.isDerivedFrom(MAP_TYPE)) {
     statement = createConstructorStatementCollection(fNode);
   } else if (fieldType.isResolved()) {
     addError(
         createErrorMessage(cNode.getName(), fNode.getName(), fieldType.getName(), "compiling"),
         fNode);
     statement = EmptyStatement.INSTANCE;
   } else {
     statement = createConstructorStatementGuarded(cNode, fNode);
   }
   return statement;
 }
 private void createConstructorOrdered(ClassNode cNode, List<PropertyNode> list) {
   final MapExpression argMap = new MapExpression();
   final Parameter[] orderedParams = new Parameter[list.size()];
   int index = 0;
   for (PropertyNode pNode : list) {
     Parameter param = new Parameter(pNode.getField().getType(), pNode.getField().getName());
     orderedParams[index++] = param;
     argMap.addMapEntryExpression(
         new ConstantExpression(pNode.getName()), new VariableExpression(pNode.getName()));
   }
   final BlockStatement orderedBody = new BlockStatement();
   orderedBody.addStatement(
       new ExpressionStatement(
           new ConstructorCallExpression(
               ClassNode.THIS,
               new ArgumentListExpression(new CastExpression(HASHMAP_TYPE, argMap)))));
   doAddConstructor(
       cNode, new ConstructorNode(ACC_PUBLIC, orderedParams, ClassNode.EMPTY_ARRAY, orderedBody));
 }
 private void addProperty(ClassNode cNode, PropertyNode pNode) {
   final FieldNode fn = pNode.getField();
   cNode.getFields().remove(fn);
   cNode.addProperty(
       pNode.getName(),
       pNode.getModifiers() | ACC_FINAL,
       pNode.getType(),
       pNode.getInitialExpression(),
       pNode.getGetterBlock(),
       pNode.getSetterBlock());
   final FieldNode newfn = cNode.getField(fn.getName());
   cNode.getFields().remove(newfn);
   cNode.addField(fn);
 }
 private void adjustPropertyNode(PropertyNode pNode, Statement getterBody) {
   pNode.setSetterBlock(null);
   pNode.setGetterBlock(getterBody);
 }
 private void adjustPropertyForImmutability(PropertyNode pNode, List<PropertyNode> newNodes) {
   final FieldNode fNode = pNode.getField();
   fNode.setModifiers((pNode.getModifiers() & (~ACC_PUBLIC)) | ACC_FINAL | ACC_PRIVATE);
   adjustPropertyNode(pNode, createGetterBody(fNode));
   newNodes.add(pNode);
 }