Program: 10234
Project: 10234
Buggy source:
@SuppressWarnings({"String_Node_Str"}) public Set<Description> refine(Description description,int maxLength,List<Description> knownRefinements,Description currDomain){
  if (!(currDomain instanceof Thing) && !topARefinementsLength.containsKey(currDomain))   topARefinementsLength.put((NamedClass)currDomain,0);
  Set<Description> refinements=new TreeSet<Description>(conceptComparator);
  Set<Description> tmp=new HashSet<Description>();
  if (description instanceof Thing) {
    if (currDomain instanceof Thing) {
      if (maxLength > topRefinementsLength)       computeTopRefinements(maxLength);
      refinements=(TreeSet<Description>)topRefinementsCumulative.get(maxLength).clone();
    }
 else {
      if (maxLength > topARefinementsLength.get(currDomain))       computeTopRefinements(maxLength,(NamedClass)currDomain);
      refinements=(TreeSet<Description>)topARefinementsCumulative.get(currDomain).get(maxLength).clone();
    }
  }
 else   if (description instanceof Nothing) {
  }
 else   if (description instanceof NamedClass) {
    refinements.addAll(subHierarchy.getMoreSpecialConcepts(description));
    refinements.remove(new Nothing());
  }
 else   if (description instanceof Negation && description.getChild(0) instanceof NamedClass) {
    tmp=rs.getMoreGeneralConcepts(description.getChild(0));
    for (    Description c : tmp) {
      if (!(c instanceof Thing))       refinements.add(new Negation(c));
    }
  }
 else   if (description instanceof Intersection) {
    for (    Description child : description.getChildren()) {
      tmp=refine(child,maxLength - description.getLength() + child.getLength(),null,currDomain);
      for (      Description c : tmp) {
        List<Description> newChildren=(List<Description>)((LinkedList)description.getChildren()).clone();
        newChildren.add(c);
        newChildren.remove(child);
        Intersection mc=new Intersection(newChildren);
        ConceptTransformation.cleanConceptNonRecursive(mc);
        ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(mc,conceptComparator);
      }
    }
  }
 else   if (description instanceof Union) {
    for (    Description child : description.getChildren()) {
      tmp=refine(child,maxLength - description.getLength() + child.getLength(),null,currDomain);
      for (      Description c : tmp) {
        List<Description> newChildren=new LinkedList<Description>(description.getChildren());
        newChildren.remove(child);
        newChildren.add(c);
        Union md=new Union(newChildren);
        ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(md,conceptComparator);
        refinements.add(md);
      }
    }
  }
 else   if (description instanceof ObjectSomeRestriction) {
    ObjectPropertyExpression role=((ObjectQuantorRestriction)description).getRole();
    Description range=opRanges.get(role);
    tmp=refine(description.getChild(0),maxLength - 2,null,range);
    for (    Description c : tmp)     refinements.add(new ObjectSomeRestriction(((ObjectQuantorRestriction)description).getRole(),c));
    ObjectProperty ar=(ObjectProperty)role;
    Set<ObjectProperty> moreSpecialRoles=rs.getMoreSpecialRoles(ar);
    for (    ObjectProperty moreSpecialRole : moreSpecialRoles)     refinements.add(new ObjectSomeRestriction(moreSpecialRole,description.getChild(0)));
  }
 else   if (description instanceof ObjectAllRestriction) {
    ObjectPropertyExpression role=((ObjectQuantorRestriction)description).getRole();
    Description range=opRanges.get(role);
    tmp=refine(description.getChild(0),maxLength - 2,null,range);
    for (    Description c : tmp) {
      refinements.add(new ObjectAllRestriction(((ObjectQuantorRestriction)description).getRole(),c));
    }
    if (description.getChild(0) instanceof NamedClass && tmp.size() == 0) {
      refinements.add(new ObjectAllRestriction(((ObjectQuantorRestriction)description).getRole(),new Nothing()));
    }
    ObjectProperty ar=(ObjectProperty)role;
    Set<ObjectProperty> moreSpecialRoles=rs.getMoreSpecialRoles(ar);
    for (    ObjectProperty moreSpecialRole : moreSpecialRoles) {
      refinements.add(new ObjectAllRestriction(moreSpecialRole,description.getChild(0)));
    }
  }
  if (!(description instanceof Thing) && !(description instanceof Nothing) && !(description instanceof ObjectAllRestriction && description.getChild(0) instanceof Nothing)) {
    int topRefLength=maxLength - description.getLength() - 1;
    if (currDomain instanceof Thing) {
      if (topRefLength > topRefinementsLength)       computeTopRefinements(topRefLength);
    }
 else     if (topRefLength > topARefinementsLength.get(currDomain))     computeTopRefinements(topRefLength,(NamedClass)currDomain);
    if (topRefLength > 0) {
      Set<Description> topRefs;
      if (currDomain instanceof Thing)       topRefs=topRefinementsCumulative.get(topRefLength);
 else       topRefs=topARefinementsCumulative.get(currDomain).get(topRefLength);
      for (      Description c : topRefs) {
        boolean skip=false;
        if (applyAllFilter) {
          if (c instanceof ObjectAllRestriction) {
            for (            Description child : description.getChildren()) {
              if (child instanceof ObjectAllRestriction) {
                ObjectPropertyExpression r1=((ObjectAllRestriction)c).getRole();
                ObjectPropertyExpression r2=((ObjectAllRestriction)child).getRole();
                if (r1.toString().equals(r2.toString()))                 skip=true;
              }
            }
          }
        }
        if (c instanceof NamedClass && isDisjoint(description,c))         skip=true;
        if (!skip) {
          Intersection mc=new Intersection();
          mc.addChild(description);
          mc.addChild(c);
          ConceptTransformation.cleanConceptNonRecursive(mc);
          ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(mc,conceptComparator);
          refinements.add(mc);
        }
      }
    }
  }
  return refinements;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) public Set<Description> refine(Description description,int maxLength,List<Description> knownRefinements,Description currDomain){
  if (!(currDomain instanceof Thing) && !topARefinementsLength.containsKey(currDomain))   topARefinementsLength.put((NamedClass)currDomain,0);
  Set<Description> refinements=new TreeSet<Description>(conceptComparator);
  Set<Description> tmp=new HashSet<Description>();
  if (description instanceof Thing) {
    if (currDomain instanceof Thing) {
      if (maxLength > topRefinementsLength)       computeTopRefinements(maxLength);
      refinements=(TreeSet<Description>)topRefinementsCumulative.get(maxLength).clone();
    }
 else {
      if (maxLength > topARefinementsLength.get(currDomain))       computeTopRefinements(maxLength,(NamedClass)currDomain);
      refinements=(TreeSet<Description>)topARefinementsCumulative.get(currDomain).get(maxLength).clone();
    }
  }
 else   if (description instanceof Nothing) {
  }
 else   if (description instanceof NamedClass) {
    refinements.addAll(subHierarchy.getMoreSpecialConcepts(description));
    refinements.remove(new Nothing());
  }
 else   if (description instanceof Negation && description.getChild(0) instanceof NamedClass) {
    tmp=rs.getMoreGeneralConcepts(description.getChild(0));
    for (    Description c : tmp) {
      if (!(c instanceof Thing))       refinements.add(new Negation(c));
    }
  }
 else   if (description instanceof Intersection) {
    for (    Description child : description.getChildren()) {
      tmp=refine(child,maxLength - description.getLength() + child.getLength(),null,currDomain);
      for (      Description c : tmp) {
        List<Description> newChildren=(List<Description>)((LinkedList)description.getChildren()).clone();
        newChildren.add(c);
        newChildren.remove(child);
        Intersection mc=new Intersection(newChildren);
        ConceptTransformation.cleanConceptNonRecursive(mc);
        ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(mc,conceptComparator);
        refinements.add(mc);
      }
    }
  }
 else   if (description instanceof Union) {
    for (    Description child : description.getChildren()) {
      tmp=refine(child,maxLength - description.getLength() + child.getLength(),null,currDomain);
      for (      Description c : tmp) {
        List<Description> newChildren=new LinkedList<Description>(description.getChildren());
        newChildren.remove(child);
        newChildren.add(c);
        Union md=new Union(newChildren);
        ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(md,conceptComparator);
        refinements.add(md);
      }
    }
  }
 else   if (description instanceof ObjectSomeRestriction) {
    ObjectPropertyExpression role=((ObjectQuantorRestriction)description).getRole();
    Description range=opRanges.get(role);
    tmp=refine(description.getChild(0),maxLength - 2,null,range);
    for (    Description c : tmp)     refinements.add(new ObjectSomeRestriction(((ObjectQuantorRestriction)description).getRole(),c));
    ObjectProperty ar=(ObjectProperty)role;
    Set<ObjectProperty> moreSpecialRoles=rs.getMoreSpecialRoles(ar);
    for (    ObjectProperty moreSpecialRole : moreSpecialRoles)     refinements.add(new ObjectSomeRestriction(moreSpecialRole,description.getChild(0)));
  }
 else   if (description instanceof ObjectAllRestriction) {
    ObjectPropertyExpression role=((ObjectQuantorRestriction)description).getRole();
    Description range=opRanges.get(role);
    tmp=refine(description.getChild(0),maxLength - 2,null,range);
    for (    Description c : tmp) {
      refinements.add(new ObjectAllRestriction(((ObjectQuantorRestriction)description).getRole(),c));
    }
    if (description.getChild(0) instanceof NamedClass && tmp.size() == 0) {
      refinements.add(new ObjectAllRestriction(((ObjectQuantorRestriction)description).getRole(),new Nothing()));
    }
    ObjectProperty ar=(ObjectProperty)role;
    Set<ObjectProperty> moreSpecialRoles=rs.getMoreSpecialRoles(ar);
    for (    ObjectProperty moreSpecialRole : moreSpecialRoles) {
      refinements.add(new ObjectAllRestriction(moreSpecialRole,description.getChild(0)));
    }
  }
  if (!(description instanceof Thing) && !(description instanceof Nothing) && !(description instanceof ObjectAllRestriction && description.getChild(0) instanceof Nothing)) {
    int topRefLength=maxLength - description.getLength() - 1;
    if (currDomain instanceof Thing) {
      if (topRefLength > topRefinementsLength)       computeTopRefinements(topRefLength);
    }
 else     if (topRefLength > topARefinementsLength.get(currDomain))     computeTopRefinements(topRefLength,(NamedClass)currDomain);
    if (topRefLength > 0) {
      Set<Description> topRefs;
      if (currDomain instanceof Thing)       topRefs=topRefinementsCumulative.get(topRefLength);
 else       topRefs=topARefinementsCumulative.get(currDomain).get(topRefLength);
      for (      Description c : topRefs) {
        boolean skip=false;
        if (applyAllFilter) {
          if (c instanceof ObjectAllRestriction) {
            for (            Description child : description.getChildren()) {
              if (child instanceof ObjectAllRestriction) {
                ObjectPropertyExpression r1=((ObjectAllRestriction)c).getRole();
                ObjectPropertyExpression r2=((ObjectAllRestriction)child).getRole();
                if (r1.toString().equals(r2.toString()))                 skip=true;
              }
            }
          }
        }
        if (disjointChecks && c instanceof NamedClass && description instanceof NamedClass&& isDisjoint(description,c)) {
          skip=true;
        }
        if (!skip) {
          Intersection mc=new Intersection();
          mc.addChild(description);
          mc.addChild(c);
          ConceptTransformation.cleanConceptNonRecursive(mc);
          ConceptTransformation.transformToOrderedNegationNormalFormNonRecursive(mc,conceptComparator);
          refinements.add(mc);
        }
      }
    }
  }
  return refinements;
}