Program: 81142
Project: 81142
Buggy source:
/** 
 * Creates the body of a property access method that returns the JavaFX *Property instance.  If the original property was "String firstName" then the generated code would be: <p> if (firstNameProperty == null) { firstNameProperty = new javafx.beans.property.StringProperty() } return firstNameProperty
 * @param classNode        The declaring class to which the JavaFX property will be added
 * @param fxProperty       The new JavaFX property
 * @param fxFieldShortName
 * @param initExp          The initializer expression from the original Groovy property declaration
 */
private void createPropertyAccessor(ClassNode classNode,PropertyNode fxProperty,FieldNode fxFieldShortName,Expression initExp){
  FieldExpression fieldExpression=new FieldExpression(fxFieldShortName);
  ArgumentListExpression ctorArgs=initExp == null ? ArgumentListExpression.EMPTY_ARGUMENTS : new ArgumentListExpression(initExp);
  BlockStatement block=new BlockStatement();
  ClassNode fxType=fxProperty.getType();
  ClassNode implNode=PROPERTY_IMPL_MAP.get(fxType);
  if (implNode == null) {
    if (fxType.getTypeClass() == SIMPLE_LIST_PROPERTY_CNODE.getTypeClass()) {
      if (initExp != null) {
        if (initExp instanceof ListExpression || (initExp instanceof CastExpression && (((CastExpression)initExp).getType().equals(LIST_TYPE) || ((CastExpression)initExp).getType().declaresInterface(LIST_TYPE))) || (initExp instanceof ConstructorCallExpression && (((ConstructorCallExpression)initExp).getType().equals(LIST_TYPE) || ((ConstructorCallExpression)initExp).getType().declaresInterface(LIST_TYPE)))) {
          ctorArgs=new ArgumentListExpression(new MethodCallExpression(new ClassExpression(FXCOLLECTIONS_CNODE),"String_Node_Str",ctorArgs));
        }
      }
      implNode=fxType;
    }
 else     if (fxType.getTypeClass() == SIMPLE_MAP_PROPERTY_CNODE.getTypeClass()) {
      if (initExp != null) {
        if (initExp instanceof MapExpression || (initExp instanceof CastExpression && (((CastExpression)initExp).getType().equals(MAP_TYPE) || ((CastExpression)initExp).getType().declaresInterface(MAP_TYPE))) || (initExp instanceof ConstructorCallExpression && (((ConstructorCallExpression)initExp).getType().equals(MAP_TYPE) || ((ConstructorCallExpression)initExp).getType().declaresInterface(MAP_TYPE)))) {
          ctorArgs=new ArgumentListExpression(new MethodCallExpression(new ClassExpression(FXCOLLECTIONS_CNODE),"String_Node_Str",ctorArgs));
        }
      }
      implNode=fxType;
    }
 else     if (fxType.getTypeClass() == SIMPLE_SET_PROPERTY_CNODE.getTypeClass()) {
      if (initExp != null) {
        if ((initExp instanceof CastExpression && (((CastExpression)initExp).getType().equals(SET_TYPE) || ((CastExpression)initExp).getType().declaresInterface(SET_TYPE))) || (initExp instanceof ConstructorCallExpression && (((ConstructorCallExpression)initExp).getType().equals(SET_TYPE) || ((ConstructorCallExpression)initExp).getType().declaresInterface(SET_TYPE)))) {
          ctorArgs=new ArgumentListExpression(new MethodCallExpression(new ClassExpression(FXCOLLECTIONS_CNODE),"String_Node_Str",ctorArgs));
        }
      }
      implNode=fxType;
    }
 else {
      implNode=makeClassSafe(SIMPLE_OBJECT_PROPERTY_CNODE);
      GenericsType[] origGenerics=fxProperty.getType().getGenericsTypes();
      implNode.setGenericsTypes(origGenerics);
    }
  }
  Expression initExpression=new ConstructorCallExpression(implNode,ctorArgs);
  IfStatement ifStmt=new IfStatement(new BooleanExpression(new BinaryExpression(fieldExpression,Token.newSymbol(Types.COMPARE_EQUAL,0,0),ConstantExpression.NULL)),new ExpressionStatement(new BinaryExpression(fieldExpression,Token.newSymbol(Types.EQUAL,0,0),initExpression)),EmptyStatement.INSTANCE);
  block.addStatement(ifStmt);
  block.addStatement(new ReturnStatement(fieldExpression));
  String getterName=getFXPropertyGetterName(fxProperty);
  MethodNode accessor=new MethodNode(getterName,fxProperty.getModifiers(),fxProperty.getType(),Parameter.EMPTY_ARRAY,ClassNode.EMPTY_ARRAY,block);
  accessor.setSynthetic(true);
  classNode.addMethod(accessor);
  block=new BlockStatement();
  VariableExpression thisExpression=VariableExpression.THIS_EXPRESSION;
  ArgumentListExpression emptyArguments=ArgumentListExpression.EMPTY_ARGUMENTS;
  MethodCallExpression getProperty=new MethodCallExpression(thisExpression,getterName,emptyArguments);
  block.addStatement(new ReturnStatement(getProperty));
  String javaFXPropertyFunction=fxProperty.getName();
  accessor=new MethodNode(javaFXPropertyFunction,fxProperty.getModifiers(),fxProperty.getType(),Parameter.EMPTY_ARRAY,ClassNode.EMPTY_ARRAY,block);
  accessor.setSynthetic(true);
  classNode.addMethod(accessor);
  block=new BlockStatement();
  thisExpression=VariableExpression.THIS_EXPRESSION;
  emptyArguments=ArgumentListExpression.EMPTY_ARGUMENTS;
  getProperty=new MethodCallExpression(thisExpression,getterName,emptyArguments);
  block.addStatement(new ReturnStatement(getProperty));
  javaFXPropertyFunction=fxProperty.getName().replace("String_Node_Str","String_Node_Str");
  accessor=new MethodNode(javaFXPropertyFunction,fxProperty.getModifiers(),fxProperty.getType(),Parameter.EMPTY_ARRAY,ClassNode.EMPTY_ARRAY,block);
  accessor.setSynthetic(true);
  classNode.addMethod(accessor);
}

Fixed version (ground truth):
/** 
 * Creates the body of a property access method that returns the JavaFX *Property instance.  If the original property was "String firstName" then the generated code would be: <p> if (firstNameProperty == null) { firstNameProperty = new javafx.beans.property.StringProperty() } return firstNameProperty
 * @param classNode        The declaring class to which the JavaFX property will be added
 * @param fxProperty       The new JavaFX property
 * @param fxFieldShortName
 * @param initExp          The initializer expression from the original Groovy property declaration
 */
private void createPropertyAccessor(ClassNode classNode,PropertyNode fxProperty,FieldNode fxFieldShortName,Expression initExp){
  FieldExpression fieldExpression=new FieldExpression(fxFieldShortName);
  ArgumentListExpression ctorArgs=initExp == null ? ArgumentListExpression.EMPTY_ARGUMENTS : new ArgumentListExpression(initExp);
  BlockStatement block=new BlockStatement();
  ClassNode fxType=fxProperty.getType();
  ClassNode implNode=PROPERTY_IMPL_MAP.get(fxType);
  if (implNode == null) {
    if (fxType.getTypeClass() == SIMPLE_LIST_PROPERTY_CNODE.getTypeClass()) {
      if (initExp != null && initExp instanceof ListExpression || (initExp instanceof CastExpression && (((CastExpression)initExp).getType().equals(LIST_TYPE) || ((CastExpression)initExp).getType().declaresInterface(LIST_TYPE))) || (initExp instanceof ConstructorCallExpression && (((ConstructorCallExpression)initExp).getType().equals(LIST_TYPE) || ((ConstructorCallExpression)initExp).getType().declaresInterface(LIST_TYPE)))) {
        ctorArgs=new ArgumentListExpression(new MethodCallExpression(new ClassExpression(FXCOLLECTIONS_CNODE),"String_Node_Str",ctorArgs));
      }
      implNode=fxType;
    }
 else     if (fxType.getTypeClass() == SIMPLE_MAP_PROPERTY_CNODE.getTypeClass()) {
      if (initExp != null && initExp instanceof MapExpression || (initExp instanceof CastExpression && (((CastExpression)initExp).getType().equals(MAP_TYPE) || ((CastExpression)initExp).getType().declaresInterface(MAP_TYPE))) || (initExp instanceof ConstructorCallExpression && (((ConstructorCallExpression)initExp).getType().equals(MAP_TYPE) || ((ConstructorCallExpression)initExp).getType().declaresInterface(MAP_TYPE)))) {
        ctorArgs=new ArgumentListExpression(new MethodCallExpression(new ClassExpression(FXCOLLECTIONS_CNODE),"String_Node_Str",ctorArgs));
      }
      implNode=fxType;
    }
 else     if (fxType.getTypeClass() == SIMPLE_SET_PROPERTY_CNODE.getTypeClass()) {
      if (initExp != null && (initExp instanceof CastExpression && (((CastExpression)initExp).getType().equals(SET_TYPE) || ((CastExpression)initExp).getType().declaresInterface(SET_TYPE))) || (initExp instanceof ConstructorCallExpression && (((ConstructorCallExpression)initExp).getType().equals(SET_TYPE) || ((ConstructorCallExpression)initExp).getType().declaresInterface(SET_TYPE)))) {
        ctorArgs=new ArgumentListExpression(new MethodCallExpression(new ClassExpression(FXCOLLECTIONS_CNODE),"String_Node_Str",ctorArgs));
      }
      implNode=fxType;
    }
 else {
      implNode=makeClassSafe(SIMPLE_OBJECT_PROPERTY_CNODE);
      GenericsType[] origGenerics=fxProperty.getType().getGenericsTypes();
      implNode.setGenericsTypes(origGenerics);
    }
  }
  Expression initExpression=new ConstructorCallExpression(implNode,ctorArgs);
  IfStatement ifStmt=new IfStatement(new BooleanExpression(new BinaryExpression(fieldExpression,Token.newSymbol(Types.COMPARE_EQUAL,0,0),ConstantExpression.NULL)),new ExpressionStatement(new BinaryExpression(fieldExpression,Token.newSymbol(Types.EQUAL,0,0),initExpression)),EmptyStatement.INSTANCE);
  block.addStatement(ifStmt);
  block.addStatement(new ReturnStatement(fieldExpression));
  String getterName=getFXPropertyGetterName(fxProperty);
  MethodNode accessor=new MethodNode(getterName,fxProperty.getModifiers(),fxProperty.getType(),Parameter.EMPTY_ARRAY,ClassNode.EMPTY_ARRAY,block);
  accessor.setSynthetic(true);
  classNode.addMethod(accessor);
  block=new BlockStatement();
  VariableExpression thisExpression=VariableExpression.THIS_EXPRESSION;
  ArgumentListExpression emptyArguments=ArgumentListExpression.EMPTY_ARGUMENTS;
  MethodCallExpression getProperty=new MethodCallExpression(thisExpression,getterName,emptyArguments);
  block.addStatement(new ReturnStatement(getProperty));
  String javaFXPropertyFunction=fxProperty.getName();
  accessor=new MethodNode(javaFXPropertyFunction,fxProperty.getModifiers(),fxProperty.getType(),Parameter.EMPTY_ARRAY,ClassNode.EMPTY_ARRAY,block);
  accessor.setSynthetic(true);
  classNode.addMethod(accessor);
  block=new BlockStatement();
  thisExpression=VariableExpression.THIS_EXPRESSION;
  emptyArguments=ArgumentListExpression.EMPTY_ARGUMENTS;
  getProperty=new MethodCallExpression(thisExpression,getterName,emptyArguments);
  block.addStatement(new ReturnStatement(getProperty));
  javaFXPropertyFunction=fxProperty.getName().replace("String_Node_Str","String_Node_Str");
  accessor=new MethodNode(javaFXPropertyFunction,fxProperty.getModifiers(),fxProperty.getType(),Parameter.EMPTY_ARRAY,ClassNode.EMPTY_ARRAY,block);
  accessor.setSynthetic(true);
  classNode.addMethod(accessor);
}