Program: 100310
Project: 100310
Buggy source:
/** 
 * @param P governing pointer analysis
 * @throws NullPointerException if P is null
 */
public BasicHeapGraph(final PointerAnalysis P,final CallGraph callGraph) throws NullPointerException {
  super(P.getHeapModel());
  this.pointerAnalysis=P;
  this.callGraph=callGraph;
  final OrdinalSetMapping<PointerKey> pointerKeys=getPointerKeys();
  final NumberedNodeManager<Object> nodeMgr=new NumberedNodeManager<Object>(){
    public Iterator<Object> iterator(){
      return new CompoundIterator<Object>(pointerKeys.iterator(),P.getInstanceKeyMapping().iterator());
    }
    public int getNumberOfNodes(){
      return pointerKeys.getSize() + P.getInstanceKeyMapping().getSize();
    }
    public void addNode(    Object n){
      Assertions.UNREACHABLE();
    }
    public void removeNode(    Object n){
      Assertions.UNREACHABLE();
    }
    public int getNumber(    Object N){
      if (N instanceof PointerKey) {
        return pointerKeys.getMappedIndex((PointerKey)N);
      }
 else {
        if (Assertions.verifyAssertions) {
          if (!(N instanceof InstanceKey)) {
            Assertions.UNREACHABLE(N.getClass().toString());
          }
        }
        int inumber=P.getInstanceKeyMapping().getMappedIndex((InstanceKey)N);
        return (inumber == -1) ? -1 : inumber + pointerKeys.getMaximumIndex();
      }
    }
    public Object getNode(    int number){
      if (number > pointerKeys.getMaximumIndex()) {
        return P.getInstanceKeyMapping().getMappedObject(number - pointerKeys.getSize());
      }
 else {
        return pointerKeys.getMappedObject(number);
      }
    }
    public int getMaxNumber(){
      return getNumberOfNodes() - 1;
    }
    public boolean containsNode(    Object n){
      return getNumber(n) != -1;
    }
    public Iterator<Object> iterateNodes(    IntSet s){
      return new NumberedNodeIterator<Object>(s,this);
    }
  }
;
  final IBinaryNaturalRelation pred=computePredecessors(nodeMgr);
  final IntFunction<Object> toNode=new IntFunction<Object>(){
    public Object apply(    int i){
      return nodeMgr.getNode(i);
    }
  }
;
  this.G=new AbstractNumberedGraph<Object>(){
    private final EdgeManager<Object> edgeMgr=new EdgeManager<Object>(){
      public Iterator<Object> getPredNodes(      Object N){
        int n=nodeMgr.getNumber(N);
        IntSet p=pred.getRelated(n);
        if (p == null) {
          return EmptyIterator.instance();
        }
 else {
          return new IntMapIterator<Object>(p.intIterator(),toNode);
        }
      }
      public int getPredNodeCount(      Object N){
        int n=nodeMgr.getNumber(N);
        return pred.getRelatedCount(n);
      }
      public Iterator<? extends Object> getSuccNodes(      Object N){
        int[] succ=computeSuccNodeNumbers(N,nodeMgr);
        if (succ == null) {
          return EmptyIterator.instance();
        }
        SparseIntSet s=new MutableSparseIntSet(succ);
        return new IntMapIterator<Object>(s.intIterator(),toNode);
      }
      public int getSuccNodeCount(      Object N){
        int[] succ=computeSuccNodeNumbers(N,nodeMgr);
        return succ == null ? 0 : succ.length;
      }
      public void addEdge(      Object src,      Object dst){
        Assertions.UNREACHABLE();
      }
      public void removeEdge(      Object src,      Object dst){
        Assertions.UNREACHABLE();
      }
      public void removeAllIncidentEdges(      Object node){
        Assertions.UNREACHABLE();
      }
      public void removeIncomingEdges(      Object node){
        Assertions.UNREACHABLE();
      }
      public void removeOutgoingEdges(      Object node){
        Assertions.UNREACHABLE();
      }
      public boolean hasEdge(      Object src,      Object dst){
        Assertions.UNREACHABLE();
        return false;
      }
    }
;
    @Override protected NodeManager<Object> getNodeManager(){
      return nodeMgr;
    }
    @Override protected EdgeManager<Object> getEdgeManager(){
      return edgeMgr;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * @param P governing pointer analysis
 * @throws NullPointerException if P is null
 */
public BasicHeapGraph(final PointerAnalysis P,final CallGraph callGraph) throws NullPointerException {
  super(P.getHeapModel());
  this.pointerAnalysis=P;
  this.callGraph=callGraph;
  final OrdinalSetMapping<PointerKey> pointerKeys=getPointerKeys();
  final NumberedNodeManager<Object> nodeMgr=new NumberedNodeManager<Object>(){
    public Iterator<Object> iterator(){
      return new CompoundIterator<Object>(pointerKeys.iterator(),P.getInstanceKeyMapping().iterator());
    }
    public int getNumberOfNodes(){
      return pointerKeys.getSize() + P.getInstanceKeyMapping().getSize();
    }
    public void addNode(    Object n){
      Assertions.UNREACHABLE();
    }
    public void removeNode(    Object n){
      Assertions.UNREACHABLE();
    }
    public int getNumber(    Object N){
      if (N instanceof PointerKey) {
        return pointerKeys.getMappedIndex((PointerKey)N);
      }
 else {
        if (Assertions.verifyAssertions) {
          if (!(N instanceof InstanceKey)) {
            Assertions.UNREACHABLE(N.getClass().toString());
          }
        }
        int inumber=P.getInstanceKeyMapping().getMappedIndex((InstanceKey)N);
        return (inumber == -1) ? -1 : inumber + pointerKeys.getMaximumIndex() + 1;
      }
    }
    public Object getNode(    int number){
      if (number > pointerKeys.getMaximumIndex()) {
        return P.getInstanceKeyMapping().getMappedObject(number - pointerKeys.getSize());
      }
 else {
        return pointerKeys.getMappedObject(number);
      }
    }
    public int getMaxNumber(){
      return getNumberOfNodes() - 1;
    }
    public boolean containsNode(    Object n){
      return getNumber(n) != -1;
    }
    public Iterator<Object> iterateNodes(    IntSet s){
      return new NumberedNodeIterator<Object>(s,this);
    }
  }
;
  final IBinaryNaturalRelation pred=computePredecessors(nodeMgr);
  final IntFunction<Object> toNode=new IntFunction<Object>(){
    public Object apply(    int i){
      return nodeMgr.getNode(i);
    }
  }
;
  this.G=new AbstractNumberedGraph<Object>(){
    private final EdgeManager<Object> edgeMgr=new EdgeManager<Object>(){
      public Iterator<Object> getPredNodes(      Object N){
        int n=nodeMgr.getNumber(N);
        IntSet p=pred.getRelated(n);
        if (p == null) {
          return EmptyIterator.instance();
        }
 else {
          return new IntMapIterator<Object>(p.intIterator(),toNode);
        }
      }
      public int getPredNodeCount(      Object N){
        int n=nodeMgr.getNumber(N);
        return pred.getRelatedCount(n);
      }
      public Iterator<? extends Object> getSuccNodes(      Object N){
        int[] succ=computeSuccNodeNumbers(N,nodeMgr);
        if (succ == null) {
          return EmptyIterator.instance();
        }
        SparseIntSet s=new MutableSparseIntSet(succ);
        return new IntMapIterator<Object>(s.intIterator(),toNode);
      }
      public int getSuccNodeCount(      Object N){
        int[] succ=computeSuccNodeNumbers(N,nodeMgr);
        return succ == null ? 0 : succ.length;
      }
      public void addEdge(      Object src,      Object dst){
        Assertions.UNREACHABLE();
      }
      public void removeEdge(      Object src,      Object dst){
        Assertions.UNREACHABLE();
      }
      public void removeAllIncidentEdges(      Object node){
        Assertions.UNREACHABLE();
      }
      public void removeIncomingEdges(      Object node){
        Assertions.UNREACHABLE();
      }
      public void removeOutgoingEdges(      Object node){
        Assertions.UNREACHABLE();
      }
      public boolean hasEdge(      Object src,      Object dst){
        Assertions.UNREACHABLE();
        return false;
      }
    }
;
    @Override protected NodeManager<Object> getNodeManager(){
      return nodeMgr;
    }
    @Override protected EdgeManager<Object> getEdgeManager(){
      return edgeMgr;
    }
  }
;
}