Beispiel #1
0
 /**
  * Generate PPD mutants
  *
  * @param p
  * @param parent
  */
 public void generateMutant(Parameter p, String parent) {
   String declared_type = p.getTypeSpecifier().getName();
   if (hasHidingVariable(declared_type, parent)) {
     Parameter mutant = (Parameter) p.makeRecursiveCopy();
     mutant.setTypeSpecifier(new TypeName(parent));
     outputToFile(p, mutant);
   }
 }
Beispiel #2
0
  /**
   * Generate PPD mutants
   *
   * @param p
   * @param parent
   */
  public void generateMutant(Parameter p, InheritanceINFO parent) {
    String declared_type = p.getTypeSpecifier().getName();
    String parent_type = parent.getClassName();
    if (hasHidingVariable(declared_type, parent_type)) {
      Parameter mutant = (Parameter) p.makeRecursiveCopy();
      mutant.setTypeSpecifier(new TypeName(parent.getClassName()));
      outputToFile(p, mutant);
    }

    if (parent.getParent() != null) {
      generateMutant(p, parent.getParent());
    }
  }
Beispiel #3
0
  public void visit(Parameter p) throws ParseTreeException {
    this.evaluateDown(p);
    if (MutationSystem.isPrimitive(getType(p.getTypeSpecifier()))) return;

    String original_class = p.getTypeSpecifier().getName();
    InheritanceINFO inf = MutationSystem.getInheritanceInfo(original_class);

    if (inf == null) return;

    if (inf.getParent() != null) {
      generateMutant(p, inf.getParent());
    } else {
      if (original_class.equals("java.lang.Object")) return;

      try {
        Class super_class = Class.forName(original_class).getSuperclass();
        if (!((super_class == null) || (super_class.getName().equals("java.lang.Object"))))
          generateMutant(p, super_class.getName());
      } catch (Exception e) {
        return;
      }
    }
    this.evaluateUp(p);
  }