Program: 163073
Project: 163073
Buggy source:
/** 
 * Annotates the specified PSI element. It is guaranteed to be executed in non-reentrant fashion. I.e there will be no call of this method for this instance before previous call get completed. Multiple instances of the annotator might exist simultaneously, though.
 * @param element to annotate.
 * @param holder  the container which receives annotations created by the plugin.
 */
@Override public void annotate(@NotNull final PsiElement element,@NotNull final AnnotationHolder holder){
  element.accept(new PsiRecursiveElementVisitor(){
    @Override public void visitElement(    @NotNull final PsiElement element){
      if (element instanceof Call) {
        visitCall((Call)element);
      }
    }
    private void visitCall(    @NotNull final Call call){
      if (!(call instanceof AtNonNumericOperation || call instanceof AtUnqualifiedNoParenthesesCall)) {
        visitNonModuleAttributeCall(call);
      }
    }
    private void visitCallDefinitionClause(    @NotNull final Call call){
      PsiElement head=org.elixir_lang.structure_view.element.CallDefinitionClause.head(call);
      if (head != null) {
        visitCallDefinitionHead(head,call);
      }
    }
    private void visitCallDefinitionHead(    @NotNull final PsiElement head,    @NotNull final Call clause){
      PsiElement stripped=org.elixir_lang.structure_view.element.CallDefinitionHead.strip(head);
      if (stripped instanceof Call) {
        visitStrippedCallDefinitionHead((Call)stripped,clause);
      }
    }
    private void visitNonModuleAttributeCall(    @NotNull final Call call){
      if (org.elixir_lang.structure_view.element.CallDefinitionClause.is(call)) {
        visitCallDefinitionClause(call);
      }
 else {
        PsiReference reference=call.getReference();
        if (reference != null) {
          Collection<PsiElement> resolvedCollection=null;
          if (reference instanceof PsiPolyVariantReference) {
            PsiPolyVariantReference polyVariantReference=(PsiPolyVariantReference)reference;
            ResolveResult[] resolveResults;
            try {
              resolveResults=polyVariantReference.multiResolve(false);
            }
 catch (            StackOverflowError stackOverflowError) {
              Logger.error(Callable.class,"String_Node_Str",call);
              resolveResults=new ResolveResult[0];
            }
            List<ResolveResult> validResolveResults=ContainerUtil.filter(resolveResults,new Condition<ResolveResult>(){
              @Override public boolean value(              ResolveResult resolveResult){
                return resolveResult.isValidResult();
              }
            }
);
            resolvedCollection=ContainerUtil.map(validResolveResults,new com.intellij.util.Function<ResolveResult,PsiElement>(){
              @Override public PsiElement fun(              ResolveResult resolveResult){
                return resolveResult.getElement();
              }
            }
);
          }
 else {
            PsiElement resolved=reference.resolve();
            if (resolved != null) {
              resolvedCollection=Collections.singleton(resolved);
            }
          }
          if (resolvedCollection != null) {
            for (            PsiElement resolved : resolvedCollection) {
              highlight(call,reference.getRangeInElement(),resolved,holder);
            }
          }
        }
 else         if (isBitStreamSegmentOption(call)) {
          String name=call.getName();
          if (name != null && BIT_STRING_TYPES.contains(name)) {
            highlight(call,holder,ElixirSyntaxHighlighter.TYPE);
          }
        }
      }
    }
    private void visitStrippedCallDefinitionHead(    @NotNull final Call stripped,    @NotNull final Call clause){
      PsiElement functionNameElement=stripped.functionNameElement();
      if (functionNameElement != null) {
        TextAttributesKey textAttributeKey=null;
        if (org.elixir_lang.structure_view.element.CallDefinitionClause.isFunction(clause)) {
          textAttributeKey=ElixirSyntaxHighlighter.FUNCTION_DECLARATION;
        }
 else         if (org.elixir_lang.structure_view.element.CallDefinitionClause.isMacro(clause)) {
          textAttributeKey=ElixirSyntaxHighlighter.MACRO_DECLARATION;
        }
        if (textAttributeKey != null) {
          highlight(functionNameElement,holder,textAttributeKey);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Annotates the specified PSI element. It is guaranteed to be executed in non-reentrant fashion. I.e there will be no call of this method for this instance before previous call get completed. Multiple instances of the annotator might exist simultaneously, though.
 * @param element to annotate.
 * @param holder  the container which receives annotations created by the plugin.
 */
@Override public void annotate(@NotNull final PsiElement element,@NotNull final AnnotationHolder holder){
  element.accept(new PsiRecursiveElementVisitor(){
    @Override public void visitElement(    @NotNull final PsiElement element){
      if (element instanceof Call) {
        visitCall((Call)element);
      }
    }
    private void visitCall(    @NotNull final Call call){
      if (!(call instanceof AtNonNumericOperation || call instanceof AtUnqualifiedNoParenthesesCall)) {
        visitNonModuleAttributeCall(call);
      }
    }
    private void visitCallDefinitionClause(    @NotNull final Call call){
      PsiElement head=org.elixir_lang.structure_view.element.CallDefinitionClause.head(call);
      if (head != null) {
        visitCallDefinitionHead(head,call);
      }
    }
    private void visitCallDefinitionHead(    @NotNull final PsiElement head,    @NotNull final Call clause){
      PsiElement stripped=org.elixir_lang.structure_view.element.CallDefinitionHead.strip(head);
      if (stripped instanceof Call) {
        visitStrippedCallDefinitionHead((Call)stripped,clause);
      }
    }
    private void visitNonModuleAttributeCall(    @NotNull final Call call){
      if (org.elixir_lang.structure_view.element.CallDefinitionClause.is(call)) {
        visitCallDefinitionClause(call);
      }
 else {
        PsiReference reference=call.getReference();
        if (reference != null) {
          Collection<PsiElement> resolvedCollection=null;
          if (reference instanceof PsiPolyVariantReference) {
            PsiPolyVariantReference polyVariantReference=(PsiPolyVariantReference)reference;
            ResolveResult[] resolveResults;
            try {
              resolveResults=polyVariantReference.multiResolve(false);
            }
 catch (            StackOverflowError stackOverflowError) {
              Logger.error(Callable.class,"String_Node_Str",call);
              resolveResults=new ResolveResult[0];
            }
            List<ResolveResult> validResolveResults=ContainerUtil.filter(resolveResults,new Condition<ResolveResult>(){
              @Override public boolean value(              ResolveResult resolveResult){
                return resolveResult.isValidResult();
              }
            }
);
            resolvedCollection=ContainerUtil.map(validResolveResults,new com.intellij.util.Function<ResolveResult,PsiElement>(){
              @Override public PsiElement fun(              ResolveResult resolveResult){
                return resolveResult.getElement();
              }
            }
);
          }
 else {
            PsiElement resolved=reference.resolve();
            if (resolved != null) {
              resolvedCollection=Collections.singleton(resolved);
            }
          }
          if (resolvedCollection != null && resolvedCollection.size() > 0) {
            for (            PsiElement resolved : resolvedCollection) {
              highlight(call,reference.getRangeInElement(),resolved,holder);
            }
          }
 else           if (call.hasDoBlockOrKeyword()) {
            PsiElement functionNameElement=call.functionNameElement();
            if (functionNameElement != null) {
              highlight(functionNameElement.getTextRange(),holder,ElixirSyntaxHighlighter.MACRO_CALL);
            }
          }
        }
 else         if (isBitStreamSegmentOption(call)) {
          String name=call.getName();
          if (name != null && BIT_STRING_TYPES.contains(name)) {
            highlight(call,holder,ElixirSyntaxHighlighter.TYPE);
          }
        }
      }
    }
    private void visitStrippedCallDefinitionHead(    @NotNull final Call stripped,    @NotNull final Call clause){
      PsiElement functionNameElement=stripped.functionNameElement();
      if (functionNameElement != null) {
        TextAttributesKey textAttributeKey=null;
        if (org.elixir_lang.structure_view.element.CallDefinitionClause.isFunction(clause)) {
          textAttributeKey=ElixirSyntaxHighlighter.FUNCTION_DECLARATION;
        }
 else         if (org.elixir_lang.structure_view.element.CallDefinitionClause.isMacro(clause)) {
          textAttributeKey=ElixirSyntaxHighlighter.MACRO_DECLARATION;
        }
        if (textAttributeKey != null) {
          highlight(functionNameElement,holder,textAttributeKey);
        }
      }
    }
  }
);
}