Program: 9248
Project: 9248
Buggy source:
public void genLabelAndKind(MethodDeclaration methodDeclaration,IProgramElement node){
  if (methodDeclaration instanceof AdviceDeclaration) {
    AdviceDeclaration ad=(AdviceDeclaration)methodDeclaration;
    node.setKind(IProgramElement.Kind.ADVICE);
    if (ad.kind == AdviceKind.Around) {
      node.setCorrespondingType(ad.returnType.toString());
    }
    StringBuffer details=new StringBuffer();
    if (ad.pointcutDesignator != null) {
      if (ad.pointcutDesignator.getPointcut() instanceof ReferencePointcut) {
        ReferencePointcut rp=(ReferencePointcut)ad.pointcutDesignator.getPointcut();
        details.append(rp.name).append("String_Node_Str");
      }
 else       if (ad.pointcutDesignator.getPointcut() instanceof AndPointcut) {
        AndPointcut ap=(AndPointcut)ad.pointcutDesignator.getPointcut();
        if (ap.getLeft() instanceof ReferencePointcut) {
          details.append(ap.getLeft().toString()).append(DOUBLE_DOTS);
        }
 else {
          details.append(POINTCUT_ANONYMOUS).append(DOUBLE_DOTS);
        }
      }
 else       if (ad.pointcutDesignator.getPointcut() instanceof OrPointcut) {
        OrPointcut op=(OrPointcut)ad.pointcutDesignator.getPointcut();
        if (op.getLeft() instanceof ReferencePointcut) {
          details.append(op.getLeft().toString()).append(DOUBLE_DOTS);
        }
 else {
          details.append(POINTCUT_ANONYMOUS).append(DOUBLE_DOTS);
        }
      }
 else {
        details.append(POINTCUT_ANONYMOUS);
      }
    }
 else {
      details.append(POINTCUT_ABSTRACT);
    }
    node.setName(ad.kind.toString());
    node.setDetails(details.toString());
    setParameters(methodDeclaration,node);
  }
 else   if (methodDeclaration instanceof PointcutDeclaration) {
    PointcutDeclaration pd=(PointcutDeclaration)methodDeclaration;
    node.setKind(IProgramElement.Kind.POINTCUT);
    node.setName(translatePointcutName(new String(methodDeclaration.selector)));
    setParameters(methodDeclaration,node);
  }
 else   if (methodDeclaration instanceof DeclareDeclaration) {
    DeclareDeclaration declare=(DeclareDeclaration)methodDeclaration;
    String name=DEC_LABEL + "String_Node_Str";
    if (declare.declareDecl instanceof DeclareErrorOrWarning) {
      DeclareErrorOrWarning deow=(DeclareErrorOrWarning)declare.declareDecl;
      if (deow.isError()) {
        node.setKind(IProgramElement.Kind.DECLARE_ERROR);
        name+=DECLARE_ERROR;
      }
 else {
        node.setKind(IProgramElement.Kind.DECLARE_WARNING);
        name+=DECLARE_WARNING;
      }
      node.setName(name);
      node.setDetails("String_Node_Str" + genDeclareMessage(deow.getMessage()) + "String_Node_Str");
    }
 else     if (declare.declareDecl instanceof DeclareParents) {
      node.setKind(IProgramElement.Kind.DECLARE_PARENTS);
      DeclareParents dp=(DeclareParents)declare.declareDecl;
      node.setName(name + DECLARE_PARENTS);
      String kindOfDP=null;
      StringBuffer details=new StringBuffer("String_Node_Str");
      TypePattern[] newParents=dp.getParents().getTypePatterns();
      for (int i=0; i < newParents.length; i++) {
        TypePattern tp=newParents[i];
        UnresolvedType tx=tp.getExactType();
        if (kindOfDP == null) {
          kindOfDP="String_Node_Str";
          try {
            ResolvedType rtx=tx.resolve(((AjLookupEnvironment)declare.scope.environment()).factory.getWorld());
            if (!rtx.isInterface())             kindOfDP="String_Node_Str";
          }
 catch (          Throwable t) {
          }
        }
        String typename=tp.toString();
        if (typename.lastIndexOf("String_Node_Str") != -1) {
          typename=typename.substring(typename.lastIndexOf("String_Node_Str") + 1);
        }
        details.append(typename);
        if ((i + 1) < newParents.length)         details.append("String_Node_Str");
      }
      node.setDetails(kindOfDP + details.toString());
    }
 else     if (declare.declareDecl instanceof DeclareSoft) {
      node.setKind(IProgramElement.Kind.DECLARE_SOFT);
      DeclareSoft ds=(DeclareSoft)declare.declareDecl;
      node.setName(name + DECLARE_SOFT);
      node.setDetails(genTypePatternLabel(ds.getException()));
    }
 else     if (declare.declareDecl instanceof DeclarePrecedence) {
      node.setKind(IProgramElement.Kind.DECLARE_PRECEDENCE);
      DeclarePrecedence ds=(DeclarePrecedence)declare.declareDecl;
      node.setName(name + DECLARE_PRECEDENCE);
      node.setDetails(genPrecedenceListLabel(ds.getPatterns()));
    }
 else     if (declare.declareDecl instanceof DeclareAnnotation) {
      DeclareAnnotation deca=(DeclareAnnotation)declare.declareDecl;
      String thekind=deca.getKind().toString();
      node.setName(name + "String_Node_Str" + thekind.substring(3));
      if (deca.getKind() == DeclareAnnotation.AT_CONSTRUCTOR) {
        node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR);
      }
 else       if (deca.getKind() == DeclareAnnotation.AT_FIELD) {
        node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD);
      }
 else       if (deca.getKind() == DeclareAnnotation.AT_METHOD) {
        node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD);
      }
 else       if (deca.getKind() == DeclareAnnotation.AT_TYPE) {
        node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_TYPE);
      }
      node.setDetails(genDecaLabel(deca));
    }
 else {
      node.setKind(IProgramElement.Kind.ERROR);
      node.setName(DECLARE_UNKNONWN);
    }
  }
 else   if (methodDeclaration instanceof InterTypeDeclaration) {
    InterTypeDeclaration itd=(InterTypeDeclaration)methodDeclaration;
    String name=itd.getOnType().toString() + "String_Node_Str" + new String(itd.getDeclaredSelector());
    if (methodDeclaration instanceof InterTypeFieldDeclaration) {
      node.setKind(IProgramElement.Kind.INTER_TYPE_FIELD);
      node.setName(name);
    }
 else     if (methodDeclaration instanceof InterTypeMethodDeclaration) {
      node.setKind(IProgramElement.Kind.INTER_TYPE_METHOD);
      node.setName(name);
    }
 else     if (methodDeclaration instanceof InterTypeConstructorDeclaration) {
      node.setKind(IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR);
      node.setName(itd.getOnType().toString() + "String_Node_Str" + itd.getOnType().toString());
    }
 else {
      node.setKind(IProgramElement.Kind.ERROR);
      node.setName(name);
    }
    node.setCorrespondingType(itd.returnType.toString());
    if (node.getKind() != IProgramElement.Kind.INTER_TYPE_FIELD) {
      setParameters(methodDeclaration,node);
    }
  }
 else {
    if (methodDeclaration.isConstructor()) {
      node.setKind(IProgramElement.Kind.CONSTRUCTOR);
    }
 else {
      node.setKind(IProgramElement.Kind.METHOD);
      if (true && methodDeclaration != null && methodDeclaration.annotations != null && methodDeclaration.scope != null) {
        for (int i=0; i < methodDeclaration.annotations.length; i++) {
          Annotation annotation=methodDeclaration.annotations[i];
          String annotationSig=new String(annotation.type.getTypeBindingPublic(methodDeclaration.scope).signature());
          if (annotationSig != null && annotationSig.charAt(1) == 'o') {
            if ("String_Node_Str".equals(annotationSig)) {
              node.setKind(IProgramElement.Kind.POINTCUT);
              break;
            }
 else             if ("String_Node_Str".equals(annotationSig) || "String_Node_Str".equals(annotationSig) || "String_Node_Str".equals(annotationSig)|| "String_Node_Str".equals(annotationSig)|| "String_Node_Str".equals(annotationSig)) {
              node.setKind(IProgramElement.Kind.ADVICE);
              node.setDetails(POINTCUT_ANONYMOUS);
              break;
            }
          }
        }
      }
    }
    node.setName(new String(methodDeclaration.selector));
    setParameters(methodDeclaration,node);
  }
}

Fixed version (ground truth):
public void genLabelAndKind(MethodDeclaration methodDeclaration,IProgramElement node){
  if (methodDeclaration instanceof AdviceDeclaration) {
    AdviceDeclaration ad=(AdviceDeclaration)methodDeclaration;
    node.setKind(IProgramElement.Kind.ADVICE);
    if (ad.kind == AdviceKind.Around) {
      node.setCorrespondingType(ad.returnType.toString());
    }
    StringBuffer details=new StringBuffer();
    if (ad.pointcutDesignator != null) {
      details.append(AsmRelationshipUtils.genPointcutDetails(ad.pointcutDesignator.getPointcut()));
    }
 else {
      details.append(AsmRelationshipUtils.POINTCUT_ABSTRACT);
    }
    node.setName(ad.kind.toString());
    node.setDetails(details.toString());
    setParameters(methodDeclaration,node);
  }
 else   if (methodDeclaration instanceof PointcutDeclaration) {
    PointcutDeclaration pd=(PointcutDeclaration)methodDeclaration;
    node.setKind(IProgramElement.Kind.POINTCUT);
    node.setName(translatePointcutName(new String(methodDeclaration.selector)));
    setParameters(methodDeclaration,node);
  }
 else   if (methodDeclaration instanceof DeclareDeclaration) {
    DeclareDeclaration declare=(DeclareDeclaration)methodDeclaration;
    String name=AsmRelationshipUtils.DEC_LABEL + "String_Node_Str";
    if (declare.declareDecl instanceof DeclareErrorOrWarning) {
      DeclareErrorOrWarning deow=(DeclareErrorOrWarning)declare.declareDecl;
      if (deow.isError()) {
        node.setKind(IProgramElement.Kind.DECLARE_ERROR);
        name+=AsmRelationshipUtils.DECLARE_ERROR;
      }
 else {
        node.setKind(IProgramElement.Kind.DECLARE_WARNING);
        name+=AsmRelationshipUtils.DECLARE_WARNING;
      }
      node.setName(name);
      node.setDetails("String_Node_Str" + AsmRelationshipUtils.genDeclareMessage(deow.getMessage()) + "String_Node_Str");
    }
 else     if (declare.declareDecl instanceof DeclareParents) {
      node.setKind(IProgramElement.Kind.DECLARE_PARENTS);
      DeclareParents dp=(DeclareParents)declare.declareDecl;
      node.setName(name + AsmRelationshipUtils.DECLARE_PARENTS);
      String kindOfDP=null;
      StringBuffer details=new StringBuffer("String_Node_Str");
      TypePattern[] newParents=dp.getParents().getTypePatterns();
      for (int i=0; i < newParents.length; i++) {
        TypePattern tp=newParents[i];
        UnresolvedType tx=tp.getExactType();
        if (kindOfDP == null) {
          kindOfDP="String_Node_Str";
          try {
            ResolvedType rtx=tx.resolve(((AjLookupEnvironment)declare.scope.environment()).factory.getWorld());
            if (!rtx.isInterface())             kindOfDP="String_Node_Str";
          }
 catch (          Throwable t) {
          }
        }
        String typename=tp.toString();
        if (typename.lastIndexOf("String_Node_Str") != -1) {
          typename=typename.substring(typename.lastIndexOf("String_Node_Str") + 1);
        }
        details.append(typename);
        if ((i + 1) < newParents.length)         details.append("String_Node_Str");
      }
      node.setDetails(kindOfDP + details.toString());
    }
 else     if (declare.declareDecl instanceof DeclareSoft) {
      node.setKind(IProgramElement.Kind.DECLARE_SOFT);
      DeclareSoft ds=(DeclareSoft)declare.declareDecl;
      node.setName(name + AsmRelationshipUtils.DECLARE_SOFT);
      node.setDetails(genTypePatternLabel(ds.getException()));
    }
 else     if (declare.declareDecl instanceof DeclarePrecedence) {
      node.setKind(IProgramElement.Kind.DECLARE_PRECEDENCE);
      DeclarePrecedence ds=(DeclarePrecedence)declare.declareDecl;
      node.setName(name + AsmRelationshipUtils.DECLARE_PRECEDENCE);
      node.setDetails(genPrecedenceListLabel(ds.getPatterns()));
    }
 else     if (declare.declareDecl instanceof DeclareAnnotation) {
      DeclareAnnotation deca=(DeclareAnnotation)declare.declareDecl;
      String thekind=deca.getKind().toString();
      node.setName(name + "String_Node_Str" + thekind.substring(3));
      if (deca.getKind() == DeclareAnnotation.AT_CONSTRUCTOR) {
        node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR);
      }
 else       if (deca.getKind() == DeclareAnnotation.AT_FIELD) {
        node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD);
      }
 else       if (deca.getKind() == DeclareAnnotation.AT_METHOD) {
        node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD);
      }
 else       if (deca.getKind() == DeclareAnnotation.AT_TYPE) {
        node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_TYPE);
      }
      node.setDetails(genDecaLabel(deca));
    }
 else {
      node.setKind(IProgramElement.Kind.ERROR);
      node.setName(AsmRelationshipUtils.DECLARE_UNKNONWN);
    }
  }
 else   if (methodDeclaration instanceof InterTypeDeclaration) {
    InterTypeDeclaration itd=(InterTypeDeclaration)methodDeclaration;
    String name=itd.getOnType().toString() + "String_Node_Str" + new String(itd.getDeclaredSelector());
    if (methodDeclaration instanceof InterTypeFieldDeclaration) {
      node.setKind(IProgramElement.Kind.INTER_TYPE_FIELD);
      node.setName(name);
    }
 else     if (methodDeclaration instanceof InterTypeMethodDeclaration) {
      node.setKind(IProgramElement.Kind.INTER_TYPE_METHOD);
      node.setName(name);
    }
 else     if (methodDeclaration instanceof InterTypeConstructorDeclaration) {
      node.setKind(IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR);
      node.setName(itd.getOnType().toString() + "String_Node_Str" + itd.getOnType().toString());
    }
 else {
      node.setKind(IProgramElement.Kind.ERROR);
      node.setName(name);
    }
    node.setCorrespondingType(itd.returnType.toString());
    if (node.getKind() != IProgramElement.Kind.INTER_TYPE_FIELD) {
      setParameters(methodDeclaration,node);
    }
  }
 else {
    if (methodDeclaration.isConstructor()) {
      node.setKind(IProgramElement.Kind.CONSTRUCTOR);
    }
 else {
      node.setKind(IProgramElement.Kind.METHOD);
      if (true && methodDeclaration != null && methodDeclaration.annotations != null && methodDeclaration.scope != null) {
        for (int i=0; i < methodDeclaration.annotations.length; i++) {
          Annotation annotation=methodDeclaration.annotations[i];
          String annotationSig=new String(annotation.type.getTypeBindingPublic(methodDeclaration.scope).signature());
          if (annotationSig != null && annotationSig.charAt(1) == 'o') {
            if ("String_Node_Str".equals(annotationSig)) {
              node.setKind(IProgramElement.Kind.POINTCUT);
              break;
            }
 else             if ("String_Node_Str".equals(annotationSig) || "String_Node_Str".equals(annotationSig) || "String_Node_Str".equals(annotationSig)|| "String_Node_Str".equals(annotationSig)|| "String_Node_Str".equals(annotationSig)) {
              node.setKind(IProgramElement.Kind.ADVICE);
              node.setDetails(AsmRelationshipUtils.POINTCUT_ANONYMOUS);
              break;
            }
          }
        }
      }
    }
    node.setName(new String(methodDeclaration.selector));
    setParameters(methodDeclaration,node);
  }
}