Example #1
0
  public void visit(MethodCall p) throws ParseTreeException {
    if (isSameObject(p, original_methodcall)) {
      Expression expr = p.getReferenceExpr();
      TypeName reftype = p.getReferenceType();

      if (expr != null) {
        if (expr instanceof Leaf
            || expr instanceof ArrayAccess
            || expr instanceof FieldAccess
            || expr instanceof MethodCall
            || expr instanceof Variable) {
          expr.accept(this);
        } else {
          writeParenthesis(expr);
        }
      } else if (reftype != null) {
        reftype.accept(this);
      }

      // -------------------------------------------------------------
      mutated_line = line_num;
      out.print(mutant);
      writeLog(
          removeNewline(
              p.toString()
                  + " =>  "
                  + p.toString().substring(0, p.toString().length() - ".clone()".length())));
      // -------------------------------------------------------------

    } else {
      super.visit(p);
    }
  }
Example #2
0
 public void visit(ExpressionStatement p) throws ParseTreeException {
   if (isSameObject(p, original_stmt)) {
     // -------------------------------------------------------------
     writeTab();
     out.println("try{");
     line_num++;
     mutated_line = line_num;
     pushNest();
     writeTab();
     out.println(mutant + ";");
     popNest();
     writeLog(removeNewline(original_stmt.toString() + " => " + mutant));
     writeTab();
     out.println("}catch(CloneNotSupportedException cnse){");
     line_num++;
     pushNest();
     writeTab();
     out.println("System.err.println(cnse);");
     popNest();
     line_num++;
     writeTab();
     out.println("}");
     line_num++;
     // -------------------------------------------------------------
   } else {
     super.visit(p);
   }
 }
Example #3
0
  /** Log mutated line */
  public void visit(BinaryExpression p) throws ParseTreeException {
    if (isSameObject(p, original)) {
      BinaryExpression mutant_exp;
      mutant_exp = (BinaryExpression) original.makeRecursiveCopy();
      mutant_exp.setOperator(mutant_op);
      super.visit(mutant_exp);

      String operator = mutant_exp.operatorString();
      out.print(" " + operator + " ");
      // -----------------------------------------------------------
      mutated_line = line_num;
      String log_str = p.operatorString() + " => " + operator;
      writeLog(removeNewline(log_str));
      // -------------------------------------------------------------

      mutant_exp = null;
    } else {
      super.visit(p);
    }
  }
Example #4
0
 public void visit(AssignmentExpression p) throws ParseTreeException {
   if (isSameObject(p, original)) {
     // -------------------------------------------------------------
     mutated_line = line_num;
     out.print(mutant);
     writeLog(removeNewline(original.toString() + " => " + mutant));
     // -------------------------------------------------------------
   } else {
     super.visit(p);
   }
 }