Program: 136345
Project: 136345
Buggy source:
/** 
 * It is copy of   {@link FacetCodegenUtils#findGhostFacets(TLFacetOwner,TLFacetType)} but withthis difference that it returns all facet with given facet type from all extension hierarchy of facetOwner.
 * @param facetOwner the facet owner for which to return "ghost facets"
 * @param facetType the type of ghost facets to retrieve
 * @return List<TLFacet>
 */
public List<TLFacet> findInheritedFacets(TLFacetOwner facetOwner,TLFacetType facetType){
  Set<String> inheritedFacetNames=new HashSet<String>();
  List<TLFacet> inheritedFacets=new ArrayList<TLFacet>();
  TLFacetOwner extendedOwner=FacetCodegenUtils.getFacetOwnerExtension(facetOwner);
  Set<TLFacetOwner> visitedOwners=new HashSet<TLFacetOwner>();
  while (extendedOwner != null) {
    List<TLFacet> facetList=FacetCodegenUtils.getAllFacetsOfType(extendedOwner,facetType);
    for (    TLFacet facet : facetList) {
      String facetKey=facetType.getIdentityName(facet.getContext(),facet.getLabel());
      if (!inheritedFacetNames.contains(facetKey)) {
        inheritedFacetNames.add(facetKey);
        inheritedFacets.add(facet);
      }
    }
    visitedOwners.add(extendedOwner);
    extendedOwner=FacetCodegenUtils.getFacetOwnerExtension(extendedOwner);
    if (visitedOwners.contains(extendedOwner)) {
      break;
    }
  }
  List<TLFacet> ghostFacets=new ArrayList<TLFacet>();
  for (  TLFacet inheritedFacet : inheritedFacets) {
    TLFacet ghostFacet=new TLFacet();
    ghostFacet.setFacetType(facetType);
    ghostFacet.setContext(inheritedFacet.getContext());
    ghostFacet.setLabel(inheritedFacet.getLabel());
    ghostFacet.setOwningEntity(facetOwner);
    ghostFacets.add(ghostFacet);
  }
  return ghostFacets;
}

Fixed version (ground truth):
/** 
 * It is copy of   {@link FacetCodegenUtils#findGhostFacets(TLFacetOwner,TLFacetType)} but with this difference thatit returns all facet with given facet type from all extension hierarchy of facetOwner.
 * @param facetOwner the facet owner for which to return "ghost facets"
 * @param facetType the type of ghost facets to retrieve
 * @return List<TLFacet>
 */
public List<TLFacet> findInheritedFacets(TLFacetOwner facetOwner,TLFacetType facetType){
  Set<String> inheritedFacetNames=new HashSet<String>();
  List<TLFacet> inheritedFacets=new ArrayList<TLFacet>();
  TLFacetOwner extendedOwner=FacetCodegenUtils.getFacetOwnerExtension(facetOwner);
  Set<TLFacetOwner> visitedOwners=new HashSet<TLFacetOwner>();
  while (extendedOwner != null) {
    List<TLFacet> facetList=FacetCodegenUtils.getAllFacetsOfType(extendedOwner,facetType);
    for (    TLFacet facet : facetList) {
      String facetKey=facetType.getIdentityName(facet.getContext(),facet.getLabel());
      if (!inheritedFacetNames.contains(facetKey)) {
        inheritedFacetNames.add(facetKey);
        inheritedFacets.add(facet);
      }
    }
    visitedOwners.add(extendedOwner);
    extendedOwner=FacetCodegenUtils.getFacetOwnerExtension(extendedOwner);
    if (visitedOwners.contains(extendedOwner)) {
      break;
    }
  }
  List<TLFacet> ghostFacets=new ArrayList<TLFacet>();
  for (  TLFacet inheritedFacet : inheritedFacets) {
    TLFacet ghostFacet=new TLFacet();
    ghostFacet.setFacetType(facetType);
    ghostFacet.setContext(inheritedFacet.getContext());
    ghostFacet.setLabel(inheritedFacet.getLabel());
    ghostFacet.setOwningEntity(facetOwner);
    ghostFacets.add(ghostFacet);
  }
  return ghostFacets;
}