Program: 81607
Project: 81607
Buggy source:
public String toJavaCode(TypeSymbol currentType){
  String code="String_Node_Str";
  boolean isParentMessageSend=false;
  if (literal != null) {
    if (literal.value.equals("String_Node_Str")) {
      code+="String_Node_Str";
    }
 else     if (literal.value.equals("String_Node_Str")) {
      if (modifications.size() > 0 && modifications.get(0) instanceof CMessageSend) {
        code+="String_Node_Str";
        isParentMessageSend=true;
      }
 else {
        code+="String_Node_Str";
      }
    }
 else     if (literal.value.equals("String_Node_Str")) {
      code+="String_Node_Str";
    }
 else {
      code+=literal.toJavaCode();
    }
  }
 else   if (variable_name != null) {
    code+=variable_name;
  }
 else   if (expression != null) {
    code+="String_Node_Str" + expression.toJavaCode() + "String_Node_Str";
  }
 else   if (allocation != null) {
    code+=allocation.toJavaCode();
  }
  if (cast_type != null) {
    code="String_Node_Str" + cast_type.name + "String_Node_Str"+ code;
  }
  if (currentType == null)   currentType=getValueType();
  for (  CModification modification : modifications) {
    if (modification instanceof CArrayAccess) {
      CArrayAccess aa=(CArrayAccess)modification;
      if (aa.expression.isToken()) {
        System.err.println("String_Node_Str");
        CompilerErrors.printErrorMessage("String_Node_Str",aa);
        currentType=null;
      }
 else {
        code+="String_Node_Str" + aa.expression.toJavaCode() + "String_Node_Str";
        if (currentType == null) {
          System.err.println("String_Node_Str");
          throw new RuntimeException();
        }
        currentType=((ArrayType)currentType).getSubtype();
      }
    }
 else     if (modification instanceof CFieldAccess) {
      CFieldAccess fa=(CFieldAccess)modification;
      if (currentType instanceof ObjectType) {
        code+="String_Node_Str" + fa.name;
        currentType=((ObjectType)currentType).getFieldType(fa.name);
      }
 else       if (currentType instanceof ActorType) {
        code+="String_Node_Str" + fa.name;
        currentType=((ActorType)currentType).getFieldType(fa.name);
      }
 else       if (currentType instanceof ArrayType) {
        code+="String_Node_Str" + fa.name;
        currentType=((ArrayType)currentType).getFieldType(fa.name);
      }
 else       if (currentType instanceof PrimitiveType) {
        CompilerErrors.printErrorMessage("String_Node_Str",fa);
        currentType=null;
      }
 else {
        CompilerErrors.printErrorMessage("String_Node_Str",fa);
        currentType=null;
      }
    }
 else     if (modification instanceof CMethodInvocation) {
      CMethodInvocation mi=(CMethodInvocation)modification;
      try {
        if (currentType instanceof ObjectType) {
          MethodSymbol ms=((ObjectType)currentType).getMethod(mi.method_name,mi.arguments);
          if (ms == null) {
            CompilerErrors.printErrorMessage("String_Node_Str",mi);
            currentType=null;
          }
          currentType=ms.getReturnType();
        }
 else         if (currentType instanceof ActorType) {
          if (modifications.getFirst().equals(modification) && (isSelf() || isParent())) {
            currentType=((ActorType)currentType).getMessage(mi.method_name,mi.arguments,isParentMessageSend).getPassType();
          }
 else {
            CompilerErrors.printErrorMessage("String_Node_Str",mi);
            currentType=null;
          }
        }
 else         if (currentType instanceof ArrayType) {
          CompilerErrors.printErrorMessage("String_Node_Str",mi);
          currentType=null;
        }
 else         if (currentType instanceof PrimitiveType) {
          CompilerErrors.printErrorMessage("String_Node_Str",mi);
          currentType=null;
        }
 else {
          CompilerErrors.printErrorMessage("String_Node_Str",mi);
          currentType=null;
        }
        if (currentType != null) {
          code+="String_Node_Str" + mi.method_name + "String_Node_Str";
          for (          CExpression argument : mi.arguments) {
            if (!argument.isToken()) {
              code+=argument.toJavaCode();
              if (!argument.equals(mi.arguments.lastElement()))               code+="String_Node_Str";
            }
 else {
              CompilerErrors.printErrorMessage("String_Node_Str",argument);
            }
          }
          code+="String_Node_Str";
        }
      }
 catch (      SalsaNotFoundException snfe) {
        CompilerErrors.printErrorMessage("String_Node_Str" + snfe.toString(),mi);
        throw new RuntimeException(snfe);
      }
    }
 else     if (modification instanceof CMessageSend) {
      CMessageSend ms=(CMessageSend)modification;
      try {
        String joinDirector=SymbolTable.getJoinDirector();
        if (ms.message_property != null && !ms.message_property.name.equals("String_Node_Str")) {
          CompilerErrors.printErrorMessage("String_Node_Str" + ms.message_property.name + "String_Node_Str",ms);
        }
        String pre_code="String_Node_Str";
        if (SymbolTable.continuesToPass && !SymbolTable.withinArguments) {
          pre_code+="String_Node_Str";
        }
 else         if (SymbolTable.withinArguments) {
          pre_code+="String_Node_Str";
          pre_code+="String_Node_Str";
          pre_code+="String_Node_Str";
        }
 else         if (SymbolTable.isExpressionContinuation) {
          pre_code+="String_Node_Str";
        }
 else         if (SymbolTable.messageContinues || joinDirector != null) {
          if (SymbolTable.firstContinuation()) {
            pre_code+="String_Node_Str";
            SymbolTable.initializedFirstContinuation();
          }
          pre_code+="String_Node_Str";
        }
 else {
          pre_code+="String_Node_Str";
        }
        String expression_director_code="String_Node_Str";
        pre_code+="String_Node_Str";
        if (currentType.isInterface)         code="String_Node_Str" + code;
        code=pre_code + code + "String_Node_Str";
        if (!(currentType instanceof ActorType)) {
          CompilerErrors.printErrorMessage("String_Node_Str" + currentType.getLongSignature() + "String_Node_Str",ms);
          throw new RuntimeException();
        }
        ActorType at=(ActorType)currentType;
        MessageSymbol messageSymbol=null;
        try {
          messageSymbol=at.getMessage(ms.message_name,ms.arguments,isParentMessageSend);
        }
 catch (        SalsaNotFoundException snfe) {
          CompilerErrors.printErrorMessage("String_Node_Str" + ms.message_name + "String_Node_Str",ms);
          throw new RuntimeException(snfe);
        }
        code+=messageSymbol.getId();
        code+="String_Node_Str" + ms.message_name + "String_Node_Str";
        String argument_code="String_Node_Str";
        String argument_tokens="String_Node_Str";
        boolean hasContinuationToken=false;
        boolean hasToken=false;
        int j=0;
        for (        CExpression argument : ms.arguments) {
          if (argument.isToken()) {
            if (argument.requiresExpressionDirector()) {
              expression_director_code+=argument.getExpressionDirectorCode();
            }
            if (argument_tokens.length() > 10)             argument_tokens+="String_Node_Str";
            argument_tokens+=j;
            hasToken=true;
          }
 else           if (SymbolTable.isMutableObject(argument.getType())) {
            argument_code+="String_Node_Str" + argument.getType().getName() + "String_Node_Str";
          }
          SymbolTable.withinArguments=true;
          argument_code+=argument.toJavaCode();
          SymbolTable.withinArguments=false;
          if (SymbolTable.isMutableObject(argument.getType()))           argument_code+="String_Node_Str";
          if (!argument.equals(ms.arguments.lastElement()))           argument_code+="String_Node_Str";
          j++;
        }
        code=expression_director_code + code;
        if (hasToken) {
          argument_code+="String_Node_Str" + argument_tokens + "String_Node_Str";
        }
 else {
          argument_code+="String_Node_Str";
        }
        if (ms.arguments.size() == 0)         argument_code="String_Node_Str";
        code+=argument_code;
        if (ms.message_property != null && ms.message_property.name.equals("String_Node_Str")) {
          code+="String_Node_Str";
          for (int i=0; i < ms.message_property.arguments.size(); i++) {
            CExpression arg=ms.message_property.arguments.get(i);
            if (!arg.isToken()) {
              CompilerErrors.printErrorMessage("String_Node_Str",arg);
              throw new RuntimeException();
            }
            code+=arg.toJavaCode();
            if (i != ms.message_property.arguments.size() - 1)             code+="String_Node_Str";
          }
          if (SymbolTable.messageRequiresContinuation) {
            code+="String_Node_Str";
          }
          code+="String_Node_Str";
        }
 else         if (SymbolTable.messageRequiresContinuation) {
          code+="String_Node_Str";
        }
        if (SymbolTable.continuesToPass && !SymbolTable.withinArguments) {
          code+="String_Node_Str";
        }
        code+="String_Node_Str";
        if (joinDirector != null && !SymbolTable.messageContinues) {
          code+="String_Node_Str";
          code+=CIndent.getIndent() + "String_Node_Str" + joinDirector+ "String_Node_Str"+ joinDirector+ "String_Node_Str";
        }
        currentType=((ActorType)currentType).getMessage(ms.message_name,ms.arguments,isParentMessageSend).getPassType();
        SymbolTable.setContinuationType(currentType);
      }
 catch (      SalsaNotFoundException snfe) {
        CompilerErrors.printErrorMessage("String_Node_Str" + snfe.toString(),ms);
        throw new RuntimeException(snfe);
      }
    }
    isParentMessageSend=false;
  }
  return code;
}

Fixed version (ground truth):
public String toJavaCode(TypeSymbol currentType){
  String code="String_Node_Str";
  boolean isParentMessageSend=false;
  if (literal != null) {
    if (literal.value.equals("String_Node_Str")) {
      code+="String_Node_Str";
    }
 else     if (literal.value.equals("String_Node_Str")) {
      if (modifications.size() > 0 && modifications.get(0) instanceof CMessageSend) {
        code+="String_Node_Str";
        isParentMessageSend=true;
      }
 else {
        code+="String_Node_Str";
      }
    }
 else     if (literal.value.equals("String_Node_Str")) {
      code+="String_Node_Str";
    }
 else {
      code+=literal.toJavaCode();
    }
  }
 else   if (variable_name != null) {
    code+=variable_name;
  }
 else   if (expression != null) {
    code+="String_Node_Str" + expression.toJavaCode() + "String_Node_Str";
  }
 else   if (allocation != null) {
    code+=allocation.toJavaCode();
  }
  if (cast_type != null) {
    code="String_Node_Str" + cast_type.name + "String_Node_Str"+ code;
  }
  if (currentType == null)   currentType=getValueType();
  for (  CModification modification : modifications) {
    if (modification instanceof CArrayAccess) {
      CArrayAccess aa=(CArrayAccess)modification;
      if (aa.expression.isToken()) {
        System.err.println("String_Node_Str");
        CompilerErrors.printErrorMessage("String_Node_Str",aa);
        currentType=null;
      }
 else {
        code+="String_Node_Str" + aa.expression.toJavaCode() + "String_Node_Str";
        if (currentType == null) {
          System.err.println("String_Node_Str");
          throw new RuntimeException();
        }
        currentType=((ArrayType)currentType).getSubtype();
      }
    }
 else     if (modification instanceof CFieldAccess) {
      CFieldAccess fa=(CFieldAccess)modification;
      if (currentType instanceof ObjectType) {
        code+="String_Node_Str" + fa.name;
        currentType=((ObjectType)currentType).getFieldType(fa.name);
      }
 else       if (currentType instanceof ActorType) {
        code+="String_Node_Str" + fa.name;
        currentType=((ActorType)currentType).getFieldType(fa.name);
      }
 else       if (currentType instanceof ArrayType) {
        code+="String_Node_Str" + fa.name;
        currentType=((ArrayType)currentType).getFieldType(fa.name);
      }
 else       if (currentType instanceof PrimitiveType) {
        CompilerErrors.printErrorMessage("String_Node_Str",fa);
        currentType=null;
      }
 else {
        CompilerErrors.printErrorMessage("String_Node_Str",fa);
        currentType=null;
      }
    }
 else     if (modification instanceof CMethodInvocation) {
      CMethodInvocation mi=(CMethodInvocation)modification;
      try {
        if (currentType instanceof ObjectType) {
          MethodSymbol ms=((ObjectType)currentType).getMethod(mi.method_name,mi.arguments);
          if (ms == null) {
            CompilerErrors.printErrorMessage("String_Node_Str",mi);
            currentType=null;
          }
          currentType=ms.getReturnType();
        }
 else         if (currentType instanceof ActorType) {
          if (modifications.getFirst().equals(modification) && (isSelf() || isParent())) {
            currentType=((ActorType)currentType).getMessage(mi.method_name,mi.arguments,isParentMessageSend).getPassType();
          }
 else {
            CompilerErrors.printErrorMessage("String_Node_Str",mi);
            currentType=null;
          }
        }
 else         if (currentType instanceof ArrayType) {
          CompilerErrors.printErrorMessage("String_Node_Str",mi);
          currentType=null;
        }
 else         if (currentType instanceof PrimitiveType) {
          CompilerErrors.printErrorMessage("String_Node_Str",mi);
          currentType=null;
        }
 else {
          CompilerErrors.printErrorMessage("String_Node_Str",mi);
          currentType=null;
        }
        if (currentType != null) {
          code+="String_Node_Str" + mi.method_name + "String_Node_Str";
          for (          CExpression argument : mi.arguments) {
            if (!argument.isToken()) {
              code+=argument.toJavaCode();
              if (!argument.equals(mi.arguments.lastElement()))               code+="String_Node_Str";
            }
 else {
              CompilerErrors.printErrorMessage("String_Node_Str",argument);
            }
          }
          code+="String_Node_Str";
        }
      }
 catch (      SalsaNotFoundException snfe) {
        CompilerErrors.printErrorMessage("String_Node_Str" + snfe.toString(),mi);
        throw new RuntimeException(snfe);
      }
    }
 else     if (modification instanceof CMessageSend) {
      CMessageSend ms=(CMessageSend)modification;
      try {
        String joinDirector=SymbolTable.getJoinDirector();
        if (ms.message_property != null && !ms.message_property.name.equals("String_Node_Str")) {
          CompilerErrors.printErrorMessage("String_Node_Str" + ms.message_property.name + "String_Node_Str",ms);
        }
        String pre_code="String_Node_Str";
        if (SymbolTable.continuesToPass && !SymbolTable.withinArguments) {
          pre_code+="String_Node_Str";
        }
 else         if (SymbolTable.withinArguments) {
          pre_code+="String_Node_Str";
        }
 else         if (SymbolTable.continuationTokenMessage) {
          pre_code+="String_Node_Str";
        }
 else         if (SymbolTable.isExpressionContinuation) {
          pre_code+="String_Node_Str";
        }
 else         if (SymbolTable.messageContinues || joinDirector != null) {
          if (SymbolTable.firstContinuation()) {
            pre_code+="String_Node_Str";
            SymbolTable.initializedFirstContinuation();
          }
          pre_code+="String_Node_Str";
        }
 else {
          pre_code+="String_Node_Str";
        }
        String expression_director_code="String_Node_Str";
        pre_code+="String_Node_Str";
        if (currentType.isInterface)         code="String_Node_Str" + code;
        code=pre_code + code + "String_Node_Str";
        if (!(currentType instanceof ActorType)) {
          CompilerErrors.printErrorMessage("String_Node_Str" + currentType.getLongSignature() + "String_Node_Str",ms);
          throw new RuntimeException();
        }
        ActorType at=(ActorType)currentType;
        MessageSymbol messageSymbol=null;
        try {
          messageSymbol=at.getMessage(ms.message_name,ms.arguments,isParentMessageSend);
        }
 catch (        SalsaNotFoundException snfe) {
          CompilerErrors.printErrorMessage("String_Node_Str" + ms.message_name + "String_Node_Str",ms);
          throw new RuntimeException(snfe);
        }
        code+=messageSymbol.getId();
        code+="String_Node_Str" + ms.message_name + "String_Node_Str";
        String argument_code="String_Node_Str";
        String argument_tokens="String_Node_Str";
        boolean hasContinuationToken=false;
        boolean hasToken=false;
        int j=0;
        for (        CExpression argument : ms.arguments) {
          if (argument.isToken()) {
            if (argument.requiresExpressionDirector()) {
              expression_director_code+=argument.getExpressionDirectorCode();
            }
            if (argument_tokens.length() > 10)             argument_tokens+="String_Node_Str";
            argument_tokens+=j;
            hasToken=true;
          }
 else           if (SymbolTable.isMutableObject(argument.getType())) {
            argument_code+="String_Node_Str" + argument.getType().getName() + "String_Node_Str";
          }
          SymbolTable.withinArguments=true;
          argument_code+=argument.toJavaCode();
          SymbolTable.withinArguments=false;
          if (SymbolTable.isMutableObject(argument.getType()))           argument_code+="String_Node_Str";
          if (!argument.equals(ms.arguments.lastElement()))           argument_code+="String_Node_Str";
          j++;
        }
        code=expression_director_code + code;
        if (hasToken) {
          argument_code+="String_Node_Str" + argument_tokens + "String_Node_Str";
        }
 else {
          argument_code+="String_Node_Str";
        }
        if (ms.arguments.size() == 0)         argument_code="String_Node_Str";
        code+=argument_code;
        if (ms.message_property != null && ms.message_property.name.equals("String_Node_Str")) {
          code+="String_Node_Str";
          for (int i=0; i < ms.message_property.arguments.size(); i++) {
            CExpression arg=ms.message_property.arguments.get(i);
            if (!arg.isToken()) {
              CompilerErrors.printErrorMessage("String_Node_Str",arg);
              throw new RuntimeException();
            }
            code+=arg.toJavaCode();
            if (i != ms.message_property.arguments.size() - 1)             code+="String_Node_Str";
          }
          if (SymbolTable.messageRequiresContinuation) {
            code+="String_Node_Str";
          }
          code+="String_Node_Str";
        }
 else         if (SymbolTable.messageRequiresContinuation) {
          code+="String_Node_Str";
        }
        if (SymbolTable.continuesToPass && !SymbolTable.withinArguments) {
          code+="String_Node_Str";
        }
        code+="String_Node_Str";
        if (joinDirector != null && !SymbolTable.messageContinues) {
          code+="String_Node_Str";
          code+=CIndent.getIndent() + "String_Node_Str" + joinDirector+ "String_Node_Str"+ joinDirector+ "String_Node_Str";
        }
        currentType=((ActorType)currentType).getMessage(ms.message_name,ms.arguments,isParentMessageSend).getPassType();
        SymbolTable.setContinuationType(currentType);
      }
 catch (      SalsaNotFoundException snfe) {
        CompilerErrors.printErrorMessage("String_Node_Str" + snfe.toString(),ms);
        throw new RuntimeException(snfe);
      }
    }
    isParentMessageSend=false;
  }
  return code;
}